public IHttpActionResult PutCompany_Table(int id, Company_Table company_Table) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != company_Table.Company_Info_ID) { return(BadRequest()); } db.Entry(company_Table).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Company_TableExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { Company_Table company_Table = db.Company_Table.Find(id); db.Company_Table.Remove(company_Table); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Company_Info_ID,Company_Name,Company_Desc,Com_Pnone1,Com_Pnone2,Com_Pnone3,Comp_Manger")] Company_Table company_Table) { if (ModelState.IsValid) { db.Entry(company_Table).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(company_Table)); }
public IHttpActionResult GetCompany_Table(int id) { Company_Table company_Table = db.Company_Table.Find(id); if (company_Table == null) { return(NotFound()); } return(Ok(company_Table)); }
public IHttpActionResult PostCompany_Table(Company_Table company_Table) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Company_Table.Add(company_Table); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = company_Table.Company_Info_ID }, company_Table)); }
public IHttpActionResult DeleteCompany_Table(int id) { Company_Table company_Table = db.Company_Table.Find(id); if (company_Table == null) { return(NotFound()); } db.Company_Table.Remove(company_Table); db.SaveChanges(); return(Ok(company_Table)); }
/// <summary> /// 添加公司信息 /// </summary> /// <param name="obj">带入参数</param> /// <returns></returns> public int Insert_CompanyTableData(Company_Table obj) { return(DBHerlper.ExecuteNonQuery(GetSqlString("Insert"), CommandType.StoredProcedure, new SqlParameter[] { new SqlParameter("@Com_Scope", obj.Com_Scope), new SqlParameter("@Com_Course", obj.Com_Course), new SqlParameter("@Com_Honer", obj.Com_Honer), new SqlParameter("@Com_Introduce", obj.Com_Introduce), new SqlParameter("@Com_Logo", obj.Com_Logo), new SqlParameter("@Com_Name", obj.Com_Name), new SqlParameter("@Com_Purpose", obj.Com_Purpose), new SqlParameter("@Com_Scale", obj.Com_Scale) })); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Company_Table company_Table = db.Company_Table.Find(id); if (company_Table == null) { return(HttpNotFound()); } return(View(company_Table)); }
public ActionResult Create([Bind(Include = "Company_Info_ID,Company_Name,Company_Desc,Com_Pnone1,Com_Pnone2,Com_Pnone3,Comp_Manger")] Company_Table company_Table) { if (ModelState.IsValid) { if (db.Company_Table.ToList().Count == 0) { db.Company_Table.Add(company_Table); db.SaveChanges(); } return(RedirectToAction("Index")); } return(View(company_Table)); }
/// <summary> /// 获取全部的公司信息 /// </summary> /// <returns></returns> public List <Company_Table> GetCompanyTableAll() { List <Company_Table> list = new List <Company_Table>(); SqlDataReader dr = DBHerlper.ExecuteReader(GetSqlString("Select"), CommandType.StoredProcedure); while (dr.Read()) { Company_Table obj = new Company_Table(); obj.Com_Scope = dr["Com_Scope"].ToString(); obj.Com_Course = dr["Com_Course"].ToString(); obj.Com_Honer = dr["Com_Course"].ToString(); obj.Com_id = Convert.ToInt32(dr["Com_Course"]); obj.Com_Introduce = dr["Com_Course"].ToString(); obj.Com_Logo = (byte[])(dr["Com_Course"]); obj.Com_Name = dr["Com_Course"].ToString(); obj.Com_Purpose = dr["Com_Course"].ToString(); obj.Com_Scale = dr["Com_Course"].ToString(); list.Add(obj); } dr.Close(); return(list); }
/// <summary> /// 根据ID查询公司信息 /// </summary> /// <param name="con"></param> /// <returns></returns> public Company_Table GetCompanyTableByConn(string con) { Company_Table obj = new Company_Table(); SqlDataReader dr = DBHerlper.ExecuteReader( "Select * from Company_Table where Com_id=@Com_id", CommandType.Text, new SqlParameter[] { new SqlParameter("@Com_id", con) }); if (dr.Read()) { obj.Com_Scope = dr["Com_Scope"].ToString(); obj.Com_Course = dr["Com_Course"].ToString(); obj.Com_Honer = dr["Com_Course"].ToString(); obj.Com_id = Convert.ToInt32(dr["Com_Course"]); obj.Com_Introduce = dr["Com_Course"].ToString(); obj.Com_Logo = (byte[])(dr["Com_Course"]); obj.Com_Name = dr["Com_Course"].ToString(); obj.Com_Purpose = dr["Com_Course"].ToString(); obj.Com_Scale = dr["Com_Course"].ToString(); } dr.Close(); return(obj); }
/// <summary> /// 更改公司信息 /// </summary> /// <param name="obj">带入参数</param> /// <returns></returns> public int Update_CompanyTableData(Company_Table obj) { return(relevanceClass.Update_CompanyTableData(obj)); }
/// <summary> /// 添加公司信息 /// </summary> /// <param name="obj">带入参数</param> /// <returns></returns> public int Insert_CompanyTableData(Company_Table obj) { return(relevanceClass.Insert_CompanyTableData(obj)); }