Example #1
0
        public JsonNetResult CreateModal(SourceAuthorViewModel vm)
        {
            IList <SourceAuthor> existing = this.sourcePermissionTasks.GetSourceAuthor(vm.Author);

            if (existing != null && existing.Count > 0)
            {
                ModelState.AddModelError("Author", "Author name already exists.");
            }

            if (ModelState.IsValid)
            {
                SourceAuthor entity = new SourceAuthor();
                entity.Author = vm.Author;
                entity        = this.sourcePermissionTasks.SaveSourceAuthor(entity);
                return(JsonNet(new
                {
                    Id = entity.Id,
                    Name = entity.Author,
                    WasSuccessful = true
                }));
            }
            else
            {
                return(JsonNet(this.GetErrorsForJson()));
            }
        }
Example #2
0
        public ActionResult CreateModal()
        {
            SourceAuthorViewModel vm = new SourceAuthorViewModel();

            return(View(vm));
        }