Exemplo n.º 1
0
 public ActionResult UpdateProjection(ProjectionModel projectionUpdate)
 {
     if (Session["Username"] == null)
     {
         return(RedirectToAction("Login", "Login"));
     }
     else
     {
         if (projectionUpdate == null)
         {
             Session["ErrorMessage"] = "Please Update With Valid Details!";
         }
         if (projectionUpdate != null)
         {
             var projectionupdate = new ProjectionUpdate()
             {
                 Id           = projectionUpdate.Id,
                 Quantity     = projectionUpdate.Quantity,
                 DateInvoiced = projectionUpdate.DateInvoiced.ToString(),
                 Comments     = projectionUpdate.Comments
             };
             var IsReturnValid = ProjectionHelperService.EditProjectionModel(projectionupdate);
         }
     }
     return(RedirectToAction("Index", "Home"));
 }
Exemplo n.º 2
0
        public static async Task EditProjectionModel(ProjectionUpdate UpdateModel)
        {
            var ReturnResult = new ReturnModel();

            using (HttpClient client = new HttpClient())
            {
                client.BaseAddress = new Uri(TimeSheetAPIURl);
                HttpResponseMessage response = client.PostAsJsonAsync(string.Format("Projection/Update"), UpdateModel).Result;
                if (response.IsSuccessStatusCode)
                {
                    ReturnResult = await response.Content.ReadAsAsync <ReturnModel>();

                    HttpContext.Current.Session["ResultMessage"] = ReturnResult.Message;
                }
                else
                {
                    HttpContext.Current.Session["ErrorMessage"] = ReturnResult.Message;
                }
            }
        }