public async Task <ActionResult> CreateEdit(mstRegionAdmin myData) { if (myData.IdRegionAdmin != Guid.Empty) { HttpResponseMessage responseMessage = await client.PutAsJsonAsync(url + "/" + myData.IdRegionAdmin.ToString(), myData); if (responseMessage.IsSuccessStatusCode) { return(RedirectToAction("Index")); } return(RedirectToAction("Error")); } else { myData.CreatedDate = DateTime.Today; myData.CreatedUser = "******"; myData.IdRegionAdmin = Guid.NewGuid(); HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url, myData); if (responseMessage.IsSuccessStatusCode) { return(RedirectToAction("Index")); } return(RedirectToAction("Error")); } }
//The DELETE method public async Task <ActionResult> Delete(Guid IdData, mstRegionAdmin Emp) { HttpResponseMessage responseMessage = await client.DeleteAsync(url + "/" + IdData.ToString()); if (responseMessage.IsSuccessStatusCode) { return(RedirectToAction("Index")); } return(RedirectToAction("Error")); }
public IHttpActionResult Put(Guid id, mstRegionAdmin myData) { _repository.Put(id, myData); return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Post(mstRegionAdmin myData) { _repository.Post(myData); return(Ok(myData)); }