public ResponseDto Update(ProductUpdateDto updateDto) { ResponseDto responseDto = new ResponseDto(); ProductUpdateBo updateBo = new ProductUpdateBo() { ProductId = updateDto.ProductId, ProductUpdateTypeId = updateDto.ProductUpdateTypeId, Name = updateDto.Name, OriginCountryId = updateDto.OriginCountryId, Notes = updateDto.Notes, CategoryId = updateDto.CategoryId, ImageUniqueId = updateDto.ImageUniqueId, ImageFileTypeId = updateDto.ImageFileTypeId, Session = Session }; ResponseBo responseBo = productBusiness.Update(updateBo); responseDto = responseBo.ToResponseDto(); return(responseDto); }
public ResponseBo Update(ProductUpdateBo updateBo) { 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("@ProductId", updateBo.ProductId, DbType.Int64, ParameterDirection.Input); p.Add("@ProductUpdateTypeId", updateBo.ProductUpdateTypeId, DbType.Int32, ParameterDirection.Input); p.Add("@Name", updateBo.Name, DbType.String, ParameterDirection.Input, 255); p.Add("@BrandId", null, DbType.Int32, ParameterDirection.Input);//delete this p.Add("@OriginCountryId", updateBo.OriginCountryId, DbType.Int32, ParameterDirection.Input); p.Add("@Notes", updateBo.Notes, DbType.String, ParameterDirection.Input, 4000); p.Add("@CategoryId", updateBo.CategoryId, DbType.Int32, ParameterDirection.Input); p.Add("@ImageUniqueId", updateBo.ImageUniqueId, DbType.Guid, ParameterDirection.Input); p.Add("@ImageFileTypeId", updateBo.ImageFileTypeId, DbType.Int32, ParameterDirection.Input); p.Add("@LanguageId", updateBo.Session.RealPerson.LanguageId, DbType.Int32, ParameterDirection.Input); p.Add("@OperatorRealId", updateBo.Session.RealPerson.Id, DbType.Int64, ParameterDirection.Input); conn.Execute("spProductUpdate", 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, updateBo); } return(responseBo); }