public JsonResult UpdateOrderStaus(int QutationId, string Status, string Type) { List <MVCQutationViewModel> _QuatationModel = new List <MVCQutationViewModel>(); QutationOrderStatusTable orderstatusModel = new QutationOrderStatusTable(); List <MVCQutationViewModel> _QutationList = new List <MVCQutationViewModel>(); MVCQutationViewModel _mvcQuatationViewModel23 = new MVCQutationViewModel(); try { HttpResponseMessage res = GlobalVeriables.WebApiClient.GetAsync("APIQutation/" + QutationId.ToString()).Result; MVCQutationModel qutationModel = res.Content.ReadAsAsync <MVCQutationModel>().Result; qutationModel.Status = Status; if (qutationModel == null) { return(new JsonResult { Data = new { Status = "Fail", Message = "No record Found" } }); } HttpResponseMessage response = GlobalVeriables.WebApiClient.PutAsJsonAsync("APIQutation/" + QutationId, qutationModel).Result; if (response.StatusCode == System.Net.HttpStatusCode.OK) { GlobalVeriables.WebApiClient.DefaultRequestHeaders.Clear(); if (qutationModel != null) { orderstatusModel.Fk_QutationID = qutationModel.QutationID; orderstatusModel.Status = Status; orderstatusModel.CreateDate = DateTime.Now; orderstatusModel.CompanyId = Convert.ToInt32(Session["CompayID"]); orderstatusModel.UserId = 1; orderstatusModel.Type = "Qutation"; HttpResponseMessage response2 = GlobalVeriables.WebApiClient.PostAsJsonAsync("postOrderStatus", orderstatusModel).Result; if (response2.StatusCode == System.Net.HttpStatusCode.OK) { return(new JsonResult { Data = new { Status = "Success", Message = "Status is change successfully" } }); } else { return(new JsonResult { Data = new { Status = "Fail", Message = "Fail to change status" } }); } } } } catch (Exception ex) { return(new JsonResult { Data = new { Status = "Fail", ex.Message } }); } return(Json("", JsonRequestBehavior.AllowGet)); }
public IHttpActionResult PostProductTable(QutationOrderStatusTable OrderStausTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { db.QutationOrderStatusTables.Add(OrderStausTable); db.SaveChanges(); return(Ok()); } catch (Exception ex) { return(BadRequest()); } }