public async Task <ActionResult> Update(MeasureSupplyChainModel model)
        {
            var MeasureSupplyChain = await _measureSupplyChainService.GetMeasureSupplyChainById(model.Id);

            if (MeasureSupplyChain == null)
            {
                return(Json(new { status = "No MeasureSupplyChain found with the specified id" }));
            }
            else
            {
                MeasureSupplyChain.MeasureSupplyChainName = model.MeasureSupplyChainName;
                MeasureSupplyChain.MeasureSupplyChainCode = model.MeasureSupplyChainCode;
                MeasureSupplyChain.UpdatedDate            = DateTime.Now;
                await _measureSupplyChainService.UpdateAsync(MeasureSupplyChain);

                return(Json(new { status = "success" }));
            }
        }
        public async Task <ActionResult> Create(MeasureSupplyChainModel model)
        {
            var checkListMeasureSupplyChain = await _measureSupplyChainService.GetAllMeasureSupplyChains();

            var checkMeasureSupplyChain =
                checkListMeasureSupplyChain.FirstOrDefault(p => p.DmsCode == model.DmsCode && p.MeasureSupplyChainName == model.MeasureSupplyChainName);

            if (checkMeasureSupplyChain != null)
            {
                return(Json(new { status = "we have MeasureSupplyChain with DMS and name like this before" }));
            }

            var MeasureSupplyChain = new MeasureSupplyChain();

            MeasureSupplyChain.MeasureSupplyChainName = model.MeasureSupplyChainName;
            MeasureSupplyChain.MeasureSupplyChainCode = model.MeasureSupplyChainCode;
            MeasureSupplyChain.CreatedDate            = DateTime.Now;
            MeasureSupplyChain.UpdatedDate            = DateTime.Now;

            await _measureSupplyChainService.CreateAsync(MeasureSupplyChain);

            return(Json(new { status = "success" }));
        }