// GET: Admin/ShClass/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SHCLASS sHCLASS = Service.FindOne(id); if (sHCLASS == null) { return(HttpNotFound()); } return(View(sHCLASS)); }
/// <summary> /// /// </summary> /// <param name="emp"></param> /// <returns></returns> public int Update(SHCLASS obj) { try { using (AllShowEntities db = new AllShowEntities()) { db.Entry(obj).State = EntityState.Modified; return(db.SaveChanges()); } } catch (DbEntityValidationException) { throw; } catch (Exception) { throw; } }
/// <summary> /// /// </summary> /// <param name="emp"></param> /// <returns></returns> public int Create(SHCLASS obj) { try { using (AllShowEntities db = new AllShowEntities()) { db.SHCLASS.Add(obj); return(db.SaveChanges()); } } catch (DbEntityValidationException) { throw; } catch (Exception) { throw; } }
/// <summary> /// /// </summary> /// <param name="emp"></param> /// <returns></returns> public int Delete(int id) { try { using (AllShowEntities db = new AllShowEntities()) { SHCLASS target = db.SHCLASS.Where(m => m.shclassno == id).FirstOrDefault(); db.SHCLASS.Remove(target); return(db.SaveChanges()); } } catch (DbEntityValidationException) { throw; } catch (Exception) { throw; } }
public ActionResult Edit([Bind(Include = "shclassno,shclassname")] SHCLASS sHCLASS) { if (ModelState.IsValid) { try { Service.Update(sHCLASS); return(RedirectToAction("Index")); } catch (DbEntityValidationException ex) { logger.Error(GetEntityErrorMsg(ex)); } catch (Exception ex) { logger.Error(ex.Message); } } return(View(sHCLASS)); }
/// <summary> /// /// </summary> /// <param name="emp"></param> /// <returns></returns> public int Update(SHCLASS obj) { return(dao.Update(obj)); }
/// <summary> /// /// </summary> /// <param name="emp"></param> /// <returns></returns> public int Create(SHCLASS obj) { return(dao.Create(obj)); }