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"));
        }
예제 #3
0
 public IHttpActionResult Put(Guid id, mstRegionAdmin myData)
 {
     _repository.Put(id, myData);
     return(StatusCode(HttpStatusCode.NoContent));
 }
예제 #4
0
 public IHttpActionResult Post(mstRegionAdmin myData)
 {
     _repository.Post(myData);
     return(Ok(myData));
 }