public ActionResult Create(LrpVM lrpUser) { try { if (ModelState.IsValid) { Lrp lrp = _mapper.Map <Lrp>(lrpUser); _lrpUser.Insert(lrp); User user = _mapper.Map <User>(lrpUser); user.Name = lrpUser.fullName; _user.Register(user, lrpUser.password); ViewBag.Message = "Lrp User Created Successfully"; return(View()); } else { ModelState .AddModelError(string.Empty, "Error"); return(View(lrpUser)); } } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.ToString()); return(View()); } }
public void Delete(int id) { Lrp model = _context.lrps.Find(id); _context.lrps.Remove(model); Save(); }
public Lrp Insert(Lrp lrp) { _context.lrps.Add(lrp); Save(); return(lrp); }
public void Update(Lrp Model) { _context.Entry(Model).State = EntityState.Modified; Save(); }