public ActionResult LeadSourceCreate(LeadSourceCreate model) { if (!ModelState.IsValid) { return(View(model)); } var userId = Guid.Parse(User.Identity.GetUserId()); var service = new LeadSourceService(userId); service.CreateSource(model); return(RedirectToAction("LeadSourceIndex")); }
public bool CreateSource(LeadSourceCreate model) { var entity = new SourceType() { OwnerId = _userId, Source = model.Source, Description = model.Description, }; using (var ctx = new ApplicationDbContext()) { ctx.SourceTypes.Add(entity); return(ctx.SaveChanges() == 1); } }