Browse Source

resume donwload finished

confirmation-email
Milad Karbasizadeh 11 years ago
parent
commit
323bbd5bec
4 changed files with 49 additions and 5 deletions
  1. +2
    -2
      Sevomin.WebFrontend.Controllers/AccountController.cs
  2. +32
    -1
      Sevomin.WebFrontend.Controllers/AuthorizedController.cs
  3. +13
    -0
      Sevomin.WebFrontend/App_Start/RouteConfig.cs
  4. +2
    -2
      Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml

+ 2
- 2
Sevomin.WebFrontend.Controllers/AccountController.cs View File

@ -21,7 +21,6 @@ namespace Sevomin.WebFrontend.Controllers
public AccountController(SevominUserManager userManager)
{
UserManager = userManager;
UserManager.UserValidator = new Sevomin.Models.Helpers.SevominUserValidator();
}
public SevominUserManager UserManager { get; private set; }
@ -49,7 +48,8 @@ namespace Sevomin.WebFrontend.Controllers
int spaceIndex = model.DisplayName.IndexOf(' ');
user = new Dovomin(model.Email, model.DisplayName, string.Empty);
user.SignUpDate = DateTime.UtcNow;
}
}
user.DisplayName = model.DisplayName;
var result = await UserManager.CreateAsync(user, model.Password);
if (result.Succeeded)
{


+ 32
- 1
Sevomin.WebFrontend.Controllers/AuthorizedController.cs View File

@ -1,9 +1,40 @@
using System.Web.Mvc;
using Microsoft.AspNet.Identity.EntityFramework;
using Sevomin.Models;
using Sevomin.Models.Helpers;
using System.Threading.Tasks;
using System.Web.Mvc;
using System.IO;
namespace Sevomin.WebFrontend.Controllers
{
[Authorize]
public class AuthorizedController : BaseController
{
public AuthorizedController()
: this(new SevominUserManager(new UserStore<User>(SevominDbContext.Current)))
{
}
public AuthorizedController(SevominUserManager userManager)
{
UserManager = userManager;
}
public SevominUserManager UserManager { get; private set; }
public async Task<ActionResult> GetResume(string userid = "", bool english = false)
{
if (string.IsNullOrWhiteSpace(userid))
userid = (await UserManager.FindByNameAsync(User.Identity.Name)).Id;
Dovomin user = await UserManager.FindByIdAsync(userid) as Dovomin;
if (user == null)
return HttpNotFound();
string path = Path.Combine(Server.MapPath("~/App_Data/resumes/"), english ? user.EnglishResume : user.PersianResume);
string fileDownloadName = string.Format("{0} {1} Resume{2}", user.DisplayName, english ? "English" : "Persian", Path.GetExtension(path));
return File(path, "application/octet-stream", fileDownloadName);
}
}
}

+ 13
- 0
Sevomin.WebFrontend/App_Start/RouteConfig.cs View File

@ -9,6 +9,19 @@ namespace Sevomin.WebFrontend
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
#region For Downloads
routes.MapRoute(
name: "EnglishResumeGrabber",
url: "dovomin/resume/english/{userid}",
defaults: new { controller = "Authorized", action = "GetResume", english = true, userid = UrlParameter.Optional }
);
routes.MapRoute(
name: "PersianResumeGrabber",
url: "dovomin/resume/persian/{userid}",
defaults: new { controller = "Authorized", action = "GetResume", english = false, userid = UrlParameter.Optional }
);
#endregion
#region For Account Controller
routes.MapRoute(
name: "Login",


+ 2
- 2
Sevomin.WebFrontend/Views/Account/ProfileDovomin.cshtml View File

@ -24,7 +24,7 @@
<input type="file" name="EnglishResume" />
@if (!string.IsNullOrWhiteSpace(Model.EnglishResume))
{
<a href="#" class="pull-left"><span class="glyphicon glyphicon-arrow-down"></span>فایل رزومه انگلیسی</a>
<a href="@Url.RouteUrl("EnglishResumeGrabber")" class="pull-left"><span class="glyphicon glyphicon-arrow-down"></span>فایل رزومه انگلیسی</a>
}
</div>
<div class="form-group">
@ -32,7 +32,7 @@
<input type="file" name="PersianResume" />
@if (!string.IsNullOrWhiteSpace(Model.PersianResume))
{
<a href="#" class="pull-left"><span class="glyphicon glyphicon-arrow-down"></span>فایل رزومه فارسی</a>
<a href="@Url.RouteUrl("PersianResumeGrabber")" class="pull-left"><span class="glyphicon glyphicon-arrow-down"></span>فایل رزومه فارسی</a>
}
</div>
<div class="form-group">


Loading…
Cancel
Save