Ejemplo n.º 1
0
        /// <summary>
        /// Validate value of ca.
        /// </summary>
        /// <param name="model">The infomation ca.</param>
        /// <returns></returns>
        private ValidationResultViewModel ValidateData(CaViewModel model)
        {
            var result = UtilityService.ValidateStringLength <DS.Data.Pocos.Ca, CaViewModel>(model);

            if (string.IsNullOrWhiteSpace(model.RequestFor))
            {
                var property = model.GetType().GetProperty(nameof(model.RequestFor));
                result.ModelStateErrorList.Add(new ModelStateError
                {
                    Key     = property.Name,
                    Message = AppText.PleaseFill + property.Name
                });
            }

            if (result.ModelStateErrorList.Count > 0)
            {
                result.ErrorFlag = true;
                result.Message   = "Error";
            }

            return(result);
        }