public async Task <IActionResult> Type(ViewModels.Type model) { context.Messages.Add(new Models.Mail { DepId = model.DepId, DestId = model.DestId, Text = model.Text, Date = DateTime.Now }); await context.SaveChangesAsync(); return(RedirectToAction("Mail")); }
public async Task <IActionResult> Type(string Id) { var user = await _userManager.FindByEmailAsync(User.Identity.Name); var model = new ViewModels.Type { DestId = Id, DepId = user.Id, DepName = user.Nick }; return(View(model)); }