public bool Post([FromBody] UOMMasterEntity UOMEntity) { try { return(_UOMMasterService.CreateUOM(UOMEntity)); } catch (Exception ex) { throw new ApiDataException(1000, "Category Not Found", HttpStatusCode.NotFound); } }
public bool Put([FromBody] UOMMasterEntity UOMMasterEntity) { try { if (UOMMasterEntity.UOMID > 0) { return(_UOMMasterService.UpdateUOM(UOMMasterEntity.UOMID, UOMMasterEntity)); } } catch (Exception ex) { throw new ApiDataException(1000, "Category not found", HttpStatusCode.NotFound); } return(false); }
public bool CreateUOM(UOMMasterEntity obj) { bool res = false; SqlCommand cmd = new SqlCommand("UOM_spSaveUOM"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@p_UOMCode", obj.UOMCode); cmd.Parameters.AddWithValue("@p_UOMName", obj.UOMName); cmd.Parameters.AddWithValue("@p_Multifier", obj.Multifier); cmd.Parameters.AddWithValue("@p_BaseUnit", obj.BaseUnit); cmd.Parameters.AddWithValue("@p_ActionBy", obj.ActionBy); var locMax = _unitOfWork.DbLayer.ExecuteNonQuery(cmd); if (locMax != Int32.MaxValue) { res = true; } return(res); }