コード例 #1
0
 // PUT api/Contact/id
 public HttpResponseMessage Put(int id, [FromBody] ContactEntity contactEntity)
 {
     if (ModelState.IsValid && id > 0)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, _contactServices.UpdateContact(id, contactEntity)));
     }
     return(Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, "Invalid Data"));
 }
コード例 #2
0
 public bool Put(int id, [FromBody] ContactEntity contactEntity)
 {
     if (id > 0)
     {
         return(_contactServices.UpdateContact(id, contactEntity));
     }
     return(false);
 }
コード例 #3
0
 public IHttpActionResult UpdateContact(int id, [FromBody] ContactEntity contactEntity)
 {
     if (ModelState.IsValid && id > 0)
     {
         return(Ok(_ContactServices.UpdateContact(id, contactEntity)));
     }
     return(BadRequest("Invalid Contact information"));
 }
コード例 #4
0
 // PUT: api/Contact/5
 /// <summary>
 ///  Update contact information
 /// Created Date: 10 Apr 2018
 /// Created By : Omkar M.
 /// </summary>
 /// <returns></returns>
 public IHttpActionResult Put([FromBody] ContactEntity contactEntity)
 {
     if (contactEntity.ContactID > 0)
     {
         int newcontact = _contactServices.UpdateContact(contactEntity.ContactID, contactEntity);
         if (newcontact != 0)
         {
             return(Ok());
         }
         else
         {
             return(Conflict());
         }
     }
     else
     {
         return(NotFound());
     }
 }
コード例 #5
0
 public ActionResult Edit(VMContact model, int id)
 {
     if (ModelState.IsValid)
     {
         int result = _contactServices.UpdateContact(model);
         if (result > 0)
         {
             return(Json(new { Status = "0", Message = "Data inserted  sucessfully." }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { Status = "1", Message = "Error Occur during processing." }, JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         ModelState.AddModelError("", "");
         return(Json(new { Status = "101", Message = "Enter Valid data" }, JsonRequestBehavior.AllowGet));
     }
 }