public ResponseBo Update(RealPersonBo realPersonBo) { ResponseBo responseBo = new ResponseBo(); try { #region Checks if (realPersonBo == null) { responseBo.IsSuccess = false; responseBo.Message = GetDicValue("xInvalidData", realPersonBo.Session.RealPerson.LanguageId); return(responseBo); } if (realPersonBo.Name.IsNull()) { responseBo.IsSuccess = false; responseBo.Message = GetDicValue("xFirstNameCantBeEmpty", realPersonBo.Session.RealPerson.LanguageId); return(responseBo); } if (realPersonBo.Surname.IsNull()) { responseBo.IsSuccess = false; responseBo.Message = GetDicValue("xLastNameCantBeEmpty", realPersonBo.Session.RealPerson.LanguageId); return(responseBo); } #endregion using (SqlConnection conn = DbAccess.Connection.GetConn()) { var p = new DynamicParameters(); p.Add("@Message", dbType: DbType.String, direction: ParameterDirection.Output, size: 255); p.Add("@IsSuccess", dbType: DbType.Boolean, direction: ParameterDirection.Output); p.Add("@PersonId", realPersonBo.Id, DbType.Int64, ParameterDirection.Input); p.Add("@Name", realPersonBo.Name, DbType.String, ParameterDirection.Input); p.Add("@Surname", realPersonBo.Surname, DbType.String, ParameterDirection.Input); p.Add("@Birthdate", realPersonBo.Birthdate, DbType.Date, ParameterDirection.Input); p.Add("@GenderId", realPersonBo.GenderId, DbType.Int32, ParameterDirection.Input); p.Add("@DefaultCurrencyId", realPersonBo.DefaultCurrencyId, DbType.Int32, ParameterDirection.Input); p.Add("@Phone", realPersonBo.Phone, DbType.String, ParameterDirection.Input); p.Add("@LanguageId", realPersonBo.Session.RealPerson.LanguageId, DbType.Int32, ParameterDirection.Input); var user = conn.Execute("spRealUpdate", p, commandType: CommandType.StoredProcedure); responseBo.Message = p.Get <string>("@Message"); responseBo.IsSuccess = p.Get <bool>("@IsSuccess"); } } catch (Exception ex) { responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, realPersonBo); } return(responseBo); }
public ResponseDto Update(RealPersonDto realPersonDto) { ResponseDto responseDto = new ResponseDto(); RealPersonBo realPersonBo = new RealPersonBo() { Id = Session.RealPerson.Id, Name = realPersonDto.Name, Surname = realPersonDto.Surname, Birthdate = realPersonDto.BirthdateNumber.ToDateTimeFromNumberNull(), GenderId = realPersonDto.GenderId, DefaultCurrencyId = realPersonDto.DefaultCurrencyId, Phone = realPersonDto.Phone, Session = Session }; responseDto = realPersonBusiness.Update(realPersonBo).ToResponseDto(); return(responseDto); }