public ActionResult RemoveConventions(AddConventionsCreate model)
        {
            var service = CreateAuthorConventionService();

            service.RemoveConvention(model);

            return(RedirectToAction("Index", "Author"));
        }
Exemplo n.º 2
0
        public bool AddConvention(AddConventionsCreate model)
        {
            foreach (int conventionId in model.Conventions)
            {
                var entity = new AuthorConvention()
                {
                    AuthorId     = model.AuthorId,
                    ConventionId = conventionId
                };

                using (var ctx = new ApplicationDbContext())
                {
                    ctx.AuthorConventions.Add(entity);
                    var changes = ctx.SaveChanges();
                }
            }

            return(true);
        }