public async Task <ActionResult> Enable(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var obj = new DeliveryRequestLineViewModel(); var url = "api/GoodsOut/DeliveryRequest/Line/getbyid/" + id; var response = await HttpClientHelper.ApiCall(url, Method.GET); if (response.IsSuccessful) { var result = response.Content; var data = JsonConvert.DeserializeObject <dynamic>(result); obj = new DeliveryRequestLineViewModel { Id = data.Id, DeliveryRequestId = data.DeliveryRequestId, PickType = data.PickType ?? "", ProductDescription = data.Product ?? "", Brand = data.Brand ?? "", ItemDescription = data.Item ?? "", UomDescription = data.Uom ?? "", Quantity = data.Quantity ?? 0, Memo = data.Memo ?? "", SpecialInstructions = data.SpecialInstructions ?? "", IsActive = data.IsActive }; } return(PartialView(obj)); }
public ActionResult Create(long id) { var obj = new DeliveryRequestLineViewModel() { DeliveryRequestId = id, CustomerId = int.Parse(CookieHelper.CustomerId), Quantity = 1 }; return(PartialView(obj)); }
public async Task <ActionResult> EnableConfirmed(DeliveryRequestLineViewModel obj, long id) { //var deliveryRequestId = Request.Form["DeliveryRequestId"]; var url = $"api/GoodsOut/DeliveryRequest/Line/enable/{id}/{_updatedBy}/"; var response = await HttpClientHelper.ApiCall(url, Method.PUT); if (response.IsSuccessful) { TempData["Message"] = "Successfully Enabled"; //Log.Error(string.Format(Type.GetType(typeof(DeliveryRequestLineController).Name) + "||Enable||DeliveryRequestLine ID::{0}||API Response::{1}", id, response)); } else { Error("An error has occurred"); Log.Error(string.Format(Type.GetType(typeof(DeliveryRequestLineController).Name) + "||Delete||DeliveryRequestLine ID::{0}||API Response::{1}", id, response)); //return RedirectToAction("Index", new { id = DeliveryRequestId }); } return(RedirectToAction("Index", new { id = obj.DeliveryRequestId })); }
public async Task <ActionResult> Edit([Bind(Include = "Id, CustomerId, DeliveryRequestId, ProductId, BrandId," + "ItemId, PickTypeId, UomId, Quantity, SpecialInstructions, Memo, IsActive, CreatedBy, DateCreated")] DeliveryRequestLineViewModel obj) { obj.UpdatedBy = CookieHelper.EmailAddress; var url = "api/GoodsOut/DeliveryRequest/Line/update"; var response = await HttpClientHelper.ApiCall(url, Method.PUT, obj); if (response.IsSuccessful) { TempData["Message"] = "Successfully Updated"; //Log.Error(string.Format(Type.GetType(typeof(DeliveryRequestLineController).Name) + "||Update||DeliveryRequestLine ID::{0}||API Response::{1}", obj.Id, response)); } else { Error("An error has occurred"); Log.Error(string.Format(Type.GetType(typeof(DeliveryRequestLineController).Name) + "||Update||DeliveryRequestLine ID::{0}||API Response::{1}", obj.Id, response)); //return PartialView(obj); } return(RedirectToAction("Index", new { id = obj.DeliveryRequestId })); }