Beispiel #1
0
 public ActionResult Edit(ItemViewModel model)
 {
     if (ModelState.IsValid)
     {
         Responses responses = ItemRepo.Update(model);
         if (responses.Success)
         {
             return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { success = false, message = "Error msg" }, JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(new { success = false, message = "Invalid" }, JsonRequestBehavior.AllowGet));
 }
 public ActionResult Create(ItemViewModel model)
 {
     if (ModelState.IsValid)
     {
         Responses responses = ItemRepo.Update(model);
         if (responses.Success)
         {
             return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { success = false, message = responses.Message }, JsonRequestBehavior.AllowGet));
         }
     }
     return(Json(new { success = false, message = ModelState.ToString() }, JsonRequestBehavior.AllowGet));
 }
Beispiel #3
0
 // PUT api/<controller>/5
 public Responses Put(int id, [FromBody] ItemViewModel entity)
 {
     entity.Id = id;
     return(ItemRepo.Update(entity));
 }
Beispiel #4
0
 // POST api/<controller>
 public Responses Post([FromBody] ItemViewModel entity)
 {
     return(ItemRepo.Update(entity));
 }