public ActionResult Create(ActorCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = CreateActorService(); service.CreateActor(model); return(RedirectToAction("Index")); }
public bool CreateActor(ActorCreate model) { var entity = new Actor() { UserId = _userId, Name = model.Name }; using (var ctx = new ApplicationDbContext()) { ctx.Actors.Add(entity); return(ctx.SaveChanges() == 1); } }