public IActionResult EditCostCenterPost(CostCenterEditViewModel model)
        {
            var farm = _farm.EditCostCenter(model, GetCurrentUserAsync().Result.UserName).Result;

            if (ModelState.IsValid)
            {
                if (farm.Succeeded)
                {
                    _toastNotification.AddSuccessToastMessage(farm.OkMessage, new ToastrOptions
                    {
                        PositionClass = ToastPositions.TopCenter
                    });
                    return(RedirectToAction(nameof(ListCostCenter)));
                }

                _toastNotification.AddWarningToastMessage(farm.Errors, new ToastrOptions
                {
                    PositionClass = ToastPositions.TopCenter
                });
                ViewBag.LocationList = _farm.GetLocationList(model.Id);
                ViewBag.Code         = model.Code;
                return(View(nameof(EditCostCenter), model));
            }

            _toastNotification.AddWarningToastMessage(farm.Errors, new ToastrOptions
            {
                PositionClass = ToastPositions.TopCenter
            });
            ViewBag.LocationList = _farm.GetLocationList(model.Id);
            ViewBag.Code         = model.Code;
            return(View(nameof(EditCostCenter), model));
        }
        public IActionResult EditCostCenter(long id)
        {
            var costCenter     = _farm.GetCostCenterById(id);
            var editCostCenter = new CostCenterEditViewModel
            {
                Active        = costCenter.Active,
                Code          = costCenter.Code,
                CreatedOn     = costCenter.CreatedOn,
                Description   = costCenter.Description,
                Id            = costCenter.Id,
                LocationId    = costCenter.LocationId,
                Name          = costCenter.Name,
                WarehouseCode = costCenter.WarehouseCode,
                IsFarming     = costCenter.IsFarming,
                IsMeal        = costCenter.IsMeal,
                IsMedical     = costCenter.IsMedical
            };

            ViewBag.LocationList = _farm.GetLocationList(costCenter.Id);
            ViewBag.Code         = costCenter.Code;
            return(View(editCostCenter));
        }