Browse Source

Merge branch 'master' of c:/Users/Milad/Documents/Jobs/Codiato/sevomin-git

confirmation-email
Milad Karbasizadeh 11 years ago
parent
commit
198056d678
4 changed files with 32 additions and 2 deletions
  1. +2
    -2
      Sevomin.Models/DovominViewModel.cs
  2. +1
    -0
      Sevomin.Models/Repositories/IRepository.cs
  3. +12
    -0
      Sevomin.Models/Repositories/ParameterRepository.cs
  4. +17
    -0
      Sevomin.WebFrontend.Controllers/AccountController.cs

+ 2
- 2
Sevomin.Models/DovominViewModel.cs View File

@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Sevomin.Models.Helpers; using Sevomin.Models.Helpers;
using System.ComponentModel; using System.ComponentModel;
using Sevomin.Models.Repositories;
namespace Sevomin.Models namespace Sevomin.Models
{ {
@ -68,8 +69,7 @@ namespace Sevomin.Models
this.EnglishResume = dovomin.EnglishResume; this.EnglishResume = dovomin.EnglishResume;
this.PersianResume = dovomin.PersianResume; this.PersianResume = dovomin.PersianResume;
if (dovomin.DovominParameters == null)
return;
ParameterRepository.Current.AddParametersToDovomin(dovomin);
Parameters = new List<DovominParameterViewModel>(); Parameters = new List<DovominParameterViewModel>();
foreach (var jp in dovomin.DovominParameters) foreach (var jp in dovomin.DovominParameters)


+ 1
- 0
Sevomin.Models/Repositories/IRepository.cs View File

@ -25,5 +25,6 @@ namespace Sevomin.Models.Repositories
public interface IParameterRepository : IRepository<long, Parameter> public interface IParameterRepository : IRepository<long, Parameter>
{ {
IQueryable<Parameter> ListAll(); IQueryable<Parameter> ListAll();
void AddParametersToDovomin(Dovomin dovomin);
} }
} }

+ 12
- 0
Sevomin.Models/Repositories/ParameterRepository.cs View File

@ -62,6 +62,18 @@ namespace Sevomin.Models.Repositories
{ {
SevominDbContext.Current.SaveChanges(); SevominDbContext.Current.SaveChanges();
} }
public void AddParametersToDovomin(Dovomin dovomin)
{
foreach (var param in ListAll())
{
if (dovomin.DovominParameters.Count(x => x.ParameterId == param.Id) == 0)
{
dovomin.DovominParameters.Add(new DovominParameter(dovomin, param));
}
}
}
#endregion #endregion
} }
} }

+ 17
- 0
Sevomin.WebFrontend.Controllers/AccountController.cs View File

@ -138,5 +138,22 @@ namespace Sevomin.WebFrontend.Controllers
ModelState.AddModelError("", error); ModelState.AddModelError("", error);
} }
} }
[Authorize]
private async Task<ActionResult> Profile()
{
User u = await UserManager.FindByNameAsync(User.Identity.Name);
if (u is Avalin)
{
return View("ProfileAvalin", u as Avalin);
}
else
{
Dovomin dovomin = (Dovomin)u;
DovominViewModel dvm = new DovominViewModel(dovomin);
return View("ProfileDovomin", dvm);
}
}
} }
} }

Loading…
Cancel
Save