Beispiel #1
0
 public ActionResult Edit(int id, IFormCollection collection)
 {
     try
     {
         deptRepository.Update(id, collection["Name"].ToString());
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
 public HttpResponseMessage Put([FromBody] Dept value)
 {
     try
     {
         deptRepository.Update(value.Id, value.Name);
         return(new HttpResponseMessage(System.Net.HttpStatusCode.OK));
     }
     catch (Exception ex)
     {
         string msg = ex.Message.Replace('\n', ' ').Replace('\r', ' ');
         return(new HttpResponseMessage(System.Net.HttpStatusCode.InternalServerError)
         {
             ReasonPhrase = msg
         });
     }
 }