示例#1
0
 public IActionResult EditAbout([Bind(nameof(EditAboutModel.Id),
                                      nameof(EditAboutModel.Title),
                                      nameof(EditAboutModel.Description),
                                      nameof(EditAboutModel.imageFile))]
                                EditAboutModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             model.Edit();
             model.Response = new ResponseModel("Update Successfull", ResponseType.Success);
             return(RedirectToAction("index"));
         }
         catch (DuplicationException message)
         {
             model.Response = new ResponseModel(message.Message, ResponseType.Failure);
         }
         catch (Exception ex)
         {
             model.Response = new ResponseModel("Update Failed.", ResponseType.Failure);
             // error logger code
         }
     }
     return(View(model));
 }
示例#2
0
        public IActionResult EditAbout(int id)
        {
            var model = new EditAboutModel();

            model.Load(id);
            return(View(model));
        }