public async Task <RedirectToRouteResult> AddLaborant(OtherWorker ow, HttpPostedFileBase photo) { ow.SetPhoto(photo); db.OtherWorkers.Add(ow); await db.SaveChangesAsync(); return(RedirectToAction("Index", "Cabinet")); }
public async Task <RedirectToRouteResult> AddAdmin([Bind(Exclude = "Password")] OtherWorker u, HttpPostedFileBase photo) { string tempPassword = "******"; u.Password = tempPassword; u.SetPhoto(photo); db.OtherWorkers.Add(u); await db.SaveChangesAsync(); MailSender send = new MailSender(u.Email); send.SendMessageForConfirmAccount(Url.Action("ConfirmEmail", "Cabinet", new { id = u.Id, email = u.Email }, Request.Url.Scheme), tempPassword); return(RedirectToAction("Index", "Cabinet")); }