Пример #1
0
        public IActionResult Delete(EntryModel model)
        {
            var phonebook = new Domain.Phonebook()
            {
                Id = model.PhonebookId
            };
            var entry = model.ConvertToDomain(Domain.State.Deleted);

            phonebook.Entries.Add(entry);
            _phonebookService.Update(phonebook);
            model.IsActionSuccessful = true;
            return(Json(model));
        }
Пример #2
0
 public IActionResult Update(EntryModel model)
 {
     if (ModelState.IsValid)
     {
         var phonebook = new Domain.Phonebook()
         {
             Id = model.PhonebookId
         };
         var entry = model.ConvertToDomain(Domain.State.Modified);
         phonebook.Entries.Add(entry);
         _phonebookService.Update(phonebook);
         model.IsActionSuccessful = true;
     }
     else
     {
         model.ErrorMessages      = GetModelStateErrors(ModelState);
         model.IsActionSuccessful = false;
     }
     return(Json(model));
 }