public bool update(CateringModel catering, int id) { bool rtn = false; SqlParameter[] parameters = { new SqlParameter { ParameterName = "@id", Value = id }, new SqlParameter { ParameterName = "@name", Value = catering.name }, new SqlParameter { ParameterName = "@price", Value = catering.price }, new SqlParameter { ParameterName = "@result", Direction = ParameterDirection.Output, DbType = DbType.Int32 } }; SqlParameter[] outputs = base.ExecuteNonQuery("usp_catering_u_catering", parameters); if (outputs != null && outputs.Length > 0) { rtn = Convert.ToBoolean(outputs[0].Value); } return(rtn); }
public CateringModel get(int id) { CateringModel rtn = null; SqlParameter[] parameters = { new SqlParameter { ParameterName = "@id", Value = id, DbType = DbType.Int32 } }; DataTable dt = base.ExecuteDataTable("usp_catering_s_catering", parameters); if (dt != null && dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; rtn = new CateringModel { id = id, name = Convert.ToString(dr["name"]), price = Convert.ToDecimal(dr["price"]), createdAt = Convert.ToDateTime(dr["createdAt"]), updatedAt = Convert.ToDateTime(dr["updatedAt"]) }; } return(rtn); }
public IActionResult update(int id, CateringModel room) { CateringService service = new CateringService(); var status = true; bool result = false; try{ result = service.update(room, id); }catch (System.Exception) { status = false; } var rtn = new { status = status, result = result }; return(Ok(rtn)); }
public IActionResult get(int id) { CateringService service = new CateringService(); var status = true; CateringModel result = null; try{ result = service.get(id); }catch (System.Exception) { status = false; } var rtn = new { status = status, result = result }; return(Ok(rtn)); }
public bool update(CateringModel catering, int id) { CateringData dcatering = new CateringData(); return(dcatering.update(catering, id)); }
public bool insert(CateringModel catering) { CateringData dcatering = new CateringData(); return(dcatering.insert(catering)); }