예제 #1
0
        public IActionResult EditJudgeLoadActivity(JudgeLoadActivity model)
        {
            SetViewbagJudgeLoadActivity();
            if (!ModelState.IsValid)
            {
                return(View(nameof(EditJudgeLoadActivity), model));
            }

            string _isvalid = IsValidJudgeLoadActivity(model);

            if (_isvalid != string.Empty)
            {
                SetErrorMessage(_isvalid);
                return(View(nameof(EditJudgeLoadActivity), model));
            }

            var currentId = model.Id;

            if (service.JudgeLoadActivity_SaveData(model))
            {
                this.SaveLogOperation(currentId == 0, model.Id);
                SetSuccessMessage(MessageConstant.Values.SaveOK);
                return(RedirectToAction(nameof(EditJudgeLoadActivity), new { id = model.Id }));
            }
            else
            {
                SetErrorMessage(MessageConstant.Values.SaveFailed);
            }
            return(View(nameof(EditJudgeLoadActivity), model));
        }
예제 #2
0
        /// <summary>
        /// Добавяне на Натовареност на съдии - допълнителни дейности
        /// </summary>
        /// <returns></returns>
        public IActionResult AddJudgeLoadActivity()
        {
            var model = new JudgeLoadActivity()
            {
                DateStart = DateTime.Now,
                IsActive  = true
            };

            SetViewbagJudgeLoadActivity();
            return(View(nameof(EditJudgeLoadActivity), model));
        }
예제 #3
0
        /// <summary>
        /// Валидация преди запис на Натовареност на съдии - допълнителни дейности
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        private string IsValidJudgeLoadActivity(JudgeLoadActivity model)
        {
            if (model.Label == string.Empty)
            {
                return("Въведете име");
            }

            if (model.GroupNo != null)
            {
                if (model.GroupNo < 0)
                {
                    return("Не може да се въвежда отрицателна стойност");
                }
            }

            return(string.Empty);
        }