public ResponseBo Save(ProductCodeBo saveBo) { ResponseBo responseBo = new ResponseBo(); try { 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("@ReturnedId", dbType: DbType.Int64, direction: ParameterDirection.Output); p.Add("@OperatorRealId", saveBo.Session.RealPerson.Id, DbType.Int64, ParameterDirection.Input); p.Add("@LanguageId", saveBo.Session.RealPerson.LanguageId, DbType.Int32, ParameterDirection.Input); p.Add("@Code", saveBo.Code, DbType.String, ParameterDirection.Input, 50); p.Add("@ProductCodeTypeId", saveBo.ProductCodeTypeId, DbType.Int32, ParameterDirection.Input); p.Add("@ProductId", saveBo.ProductId, DbType.Int64, ParameterDirection.Input); conn.Execute("spProductCodeSave", p, commandType: CommandType.StoredProcedure); responseBo.Message = p.Get <string>("@Message"); responseBo.IsSuccess = p.Get <bool>("@IsSuccess"); responseBo.ReturnedId = p.Get <long?>("@ReturnedId"); } } catch (Exception ex) { responseBo = base.SaveExLog(ex, this.GetType(), MethodBase.GetCurrentMethod().Name, saveBo); } return(responseBo); }
public ResponseDto Save(ProductCodeDto saveDto) { ResponseDto responseDto = new ResponseDto(); ProductCodeBo saveBo = new ProductCodeBo() { Code = saveDto.Code, ProductCodeTypeId = saveDto.ProductCodeTypeId, ProductId = saveDto.ProductId, Session = Session }; ResponseBo responseBo = productCodeBusiness.Save(saveBo); responseDto = responseBo.ToResponseDto(); return(responseDto); }