public ValidationResult ValidateCreate(DepositConfirmModel model)
        {
            this.validationResult = new ValidationResult();

            if (model == null)
            {
                this.validationResult.AddErrorMessage(ResourceDesignation.Invalid_Designation);
                return(this.validationResult);
            }

            this.ValidateName(model.EmployeeId);

            return(this.validationResult);
        }
Beispiel #2
0
        public Response <DepositConfirmModel> Create(DepositConfirmModel model)
        {
            try
            {
                var validationResult = _depositConfirmValidation.ValidateCreate(model);
                if (!validationResult.IsValid)
                {
                    return new Response <DepositConfirmModel>
                           {
                               Message    = validationResult.ErrorMessage,
                               ResultType = ResultType.ValidationError
                           }
                }
                ;
                model.DepositConfirmId = _generator.GenerateGuid();
                model.DateCreated      = DateTime.UtcNow.ToLocalTime();

                _depositConfirmRepository.Insert(_mapper.Map <DepositConfirm>(model));
                _depositConfirmRepository.Save();

                return(new Response <DepositConfirmModel>
                {
                    Result = model,
                    ResultType = ResultType.Success
                });
            }
            catch (Exception ex)
            {
                //online error log
                var err = ex.Message;
            }

            return(new Response <DepositConfirmModel>
            {
                ResultType = ResultType.Error
            });
        }