Beispiel #1
0
        public IActionResult SaveToSRProduct([FromBody] StationeryRequisitionProductViewModel srpvm)
        {
            if (srpvm.spvm != null)
            {
                Employee emp = srfservice.getEmployee(srpvm.username);
                //int emp_id = emp.Id;

                //srfservice.SaveStationaryRetrievalProducts(srrfvm.SRProduct, emp, srrfvm.comment, srrfvm.selectedrequisition, srrfvm.srpList);

                List <SRProductViewModel> srpvmlist = new List <SRProductViewModel>();

                foreach (var product in srpvm.spvm)
                {
                    SRProductViewModel spvm = new SRProductViewModel();
                    spvm.productname = product.Product.ProductName;
                    spvm.productqty  = product.ProductCount;
                    srpvmlist.Add(spvm);
                }

                srfservice.SaveStationaryRetrievalProducts(srpvmlist, emp, srpvm.comment, srpvm.requisitionIdList, null);

                return(Ok(srpvm));
            }
            else
            {
                return(null);
            }
        }
        public IActionResult SaveToSRProduct([FromBody] RequisitionStationaryViewModel srrfvm)
        {
            bool status = srformservice.SaveStationaryRetrievalProducts(srrfvm.SRProduct, srrfvm.emp, srrfvm.comment, srrfvm.selectedrequisition, srrfvm.srpList);

            if (status == true)
            {
                return(new JsonResult(new { success = "Success" }));
            }
            else
            {
                return(new JsonResult(new { success = "Failure" }));
            }
        }