// GET: StockAssign/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var obj      = new StockAssignViewModel();
            var url      = "api/stockasign/getbyid/" + id;
            var response = await HttpClientHelper.ApiCall(url, Method.GET);

            if (response.IsSuccessful)
            {
                var result = response.Content;
                obj = JsonConvert.DeserializeObject <StockAssignViewModel>(result);
            }

            return(PartialView(obj));
        }
        public async Task <ActionResult> Create([Bind(Include = "Id,ProductId,ItemId,WarehouseId,LocationId,TotalQtyStock")] StockAssignViewModel stockAssignViewModel)
        {
            var url      = "api/stockasign/add";
            var response = await HttpClientHelper.ApiCall(url, Method.POST, stockAssignViewModel);

            if (response.IsSuccessful)
            {
                TempData["Message"] = "Successfully Created";
                return(RedirectToAction("Index"));
            }
            else
            {
                Error("An error has occurred");
                Log.Error(string.Format(Type.GetType(typeof(DeliveryRequestViewModel).Name) + "||Create||StockAssign ID::{0}||API Response::{1}", stockAssignViewModel.Id, response));
                return(RedirectToAction("Index"));
            }
            //ViewBag.ItemId = new SelectList(db.ItemViewModels, "Id", "Description", stockAssignViewModel.ItemId);
            //ViewBag.LocationId = new SelectList(db.LocationViewModels, "Id", "Description", stockAssignViewModel.LocationId);
            //ViewBag.ProductId = new SelectList(db.ProductViewModels, "Id", "Description", stockAssignViewModel.ProductId);
            //ViewBag.WarehouseId = new SelectList(db.WarehouseViewModels, "Id", "WarehouseCode", stockAssignViewModel.WarehouseId);
        }