// POST api/Contact public HttpResponseMessage Post([FromBody] ContactEntity contactEntity) { if (ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.OK, _contactServices.CreateContact(contactEntity))); } else { return(Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, "Invalid Data")); } }
public IHttpActionResult CreateContact([FromBody] ContactEntity contactEntity) { if (ModelState.IsValid) { return(Ok(_ContactServices.CreateContact(contactEntity))); } else { return(BadRequest("Invalid Contact information")); } }
// POST: api/Contact /// <summary> /// Insert contact information /// Created Date: 10 Apr 2018 /// Created By : Omkar M. /// </summary> /// <returns></returns> public IHttpActionResult Post([FromBody] ContactEntity contactEntity) { var newcontact = _contactServices.CreateContact(contactEntity); if (newcontact != 0) { return(Ok(contactEntity)); } else { return(Conflict()); } }
public ActionResult Add(VMContact model) { if (ModelState.IsValid) { int result = _contactServices.CreateContact(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)); } }
public int Post([FromBody] ContactEntity contactEntity) { return(_contactServices.CreateContact(contactEntity)); }