Ejemplo n.º 1
0
        public BaseResponse <Status> UpdateStatus(Status model)
        {
            BaseResponse <Status> response = new BaseResponse <Status>();
            var errors = Validate <Status>(model, new StatusValidator());

            if (errors.Count() > 0)
            {
                BaseResponse <Status> errResponse = new BaseResponse <Status>(model, errors);
                errResponse.IsSuccess = false;
                return(errResponse);
            }
            try
            {
                model.EditedOn = DateTime.Now;
                response.Value = _statusRepository.Edit(model);
                try
                {
                    _applicationLoggingRepository.Log("EVENT", "UPDATE", "Status", model.Id.ToString(), "", "", model, "", System.Web.HttpContext.Current.Request.UserHostAddress, model.CreatedBy);
                }
                catch
                { }
            }
            catch (Exception ex)
            {
                response.IsSuccess = false;
                response.Message   = "Error: " + ex.Message + " StackTrace: " + ex.StackTrace;
            }
            return(response);
        }