Пример #1
0
        public ActionResult Edit(long Id)
        {
            string ErrorMessage = string.Empty;

            Category   category   = new Category();
            CategoryVM categoryVM = new CategoryVM();

            //TODO : Calling Data Layer
            var IsSuccess = dalCategory.GetById(out ErrorMessage, out category, Id);

            //TODO : Mapping
            if (IsSuccess)
            {
                if (category != null)
                {
                    categoryVM.Id       = category.Id;
                    categoryVM.Name     = category.Name;
                    categoryVM.IsActive = category.IsActive;
                }
                else
                {
                    ErrorMessage = ErrorClass + " | " + "No rows!";
                    throw new Exception(ErrorMessage);
                }
            }
            else
            {
                ErrorMessage = ErrorClass + " | " + ErrorMessage;
                throw new Exception(ErrorMessage);
            }

            return(View(categoryVM));
        }