public bool Post([FromBody] SubContEntity SubContEntity) { try { return(_SubContService.Createsub(SubContEntity)); } catch (Exception ex) { throw new ApiDataException(1000, "Category Not Found", HttpStatusCode.NotFound); } }
public bool Put([FromBody] SubContEntity SubContEntity) { try { if (SubContEntity.subContID > 0) { return(_SubContService.Updatesub(SubContEntity.subContID, SubContEntity)); } } catch (Exception ex) { throw new ApiDataException(1000, "Category not found", HttpStatusCode.NotFound); } return(false); }
public bool Createsub(SubContEntity obj) { bool res = false; SqlCommand cmd = new SqlCommand("SUB_spSaveSubMaster"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@p_Name", obj.Name); cmd.Parameters.AddWithValue("@p_Address", obj.Address); cmd.Parameters.AddWithValue("@p_GstNo", obj.GstNo); cmd.Parameters.AddWithValue("@p_contactNumber", obj.contactNumber); cmd.Parameters.AddWithValue("@p_supplierID", obj.supplierID); cmd.Parameters.AddWithValue("@p_emailID", obj.emailID); cmd.Parameters.AddWithValue("@p_ActionBy", obj.ActionBy); var locMax = _unitOfWork.DbLayer.ExecuteNonQuery(cmd); if (locMax != Int32.MaxValue) { res = true; } return(res); }