public ActionResult Create(doctor doctor) { db.doctor.Add(doctor); db.SaveChanges(); return(RedirectToAction("Index")); }
public IHttpActionResult PutShoppingCartItem(int id, ShoppingCartItem shoppingCartItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != shoppingCartItem.Id) { return(BadRequest()); } db.Entry(shoppingCartItem).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ShoppingCartItemExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create([Bind(Include = "hos_id,hos_name,hos_eng_name,hos_address,hos_phone,hos_display,c_id,d_id")] hospital hospital, int?cityId) { //var c = db.hospital.Count(); //string id; //id = New_Hos_id(c); if (ModelState.IsValid) { //hospital = new hospital() { hos_id = id }; db.hospital.Add(hospital); db.SaveChanges(); if (cityId == null) { return(RedirectToAction("Index")); } return(RedirectToAction("Index", new { cityId = cityId })); } //var c = db.hospital.Count(); //string id; //id = New_Hos_id(c); //ViewBag.hos_id = id; ViewBag.cityname = new SelectList(db.city.Where(m => m.c_id == cityId), "c_id", "city_name"); ViewBag.d_id = new SelectList(db.district.Where(m => m.c_id == cityId), "d_id", "district_name"); return(View(hospital)); }
public ActionResult Create([Bind(Include = "sn,doc_id,dep_id,hos_id,starttime,endtime,s_display")] schedule schedule) { if (ModelState.IsValid) { db.schedule.Add(schedule); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(schedule)); }
public ActionResult Create([Bind(Include = "ing_id,ing_name,ing_eng_name,ing_category,ing_restricted,ing_limitation")] ingrediant ingrediant) { if (ModelState.IsValid) { db.ingrediant.Add(ingrediant); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ingrediant)); }
public ActionResult Create(string a_id, DateTime a_date, string a_content, bool a_display) { announcement anns = new announcement(); anns.a_id = a_id; anns.a_date = a_date; anns.a_content = a_content; anns.a_display = a_display; db.announcement.Add(anns); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "hos_id,hos_name,hos_eng_name,hos_address,hos_phone,hos_display,c_id,d_id")] hospital hospital, int cityname) { if (ModelState.IsValid) { db.hospital.Add(hospital); db.SaveChanges(); return(RedirectToAction("Index", new { cityname = cityname })); } //ViewBag.c_id = new SelectList(db.city, "c_id", "city_name", hospital.c_id); //ViewBag.d_id = new SelectList(db.district, "d_id", "district_name", hospital.d_id); return(View(hospital)); }
public ActionResult Create(doctor doctor) { /*將資料庫ID由大到小排序,取出第一筆資料,並呼叫方法取得新ID*/ var Doc_Desc = from m in db.doctor orderby m.doc_id descending select m.doc_id; string Doc_First = Doc_Desc.FirstOrDefault(), New_id; New_id = New_Doc_id(Doc_First); /***********************************************************/ doctor.doc_id = New_id; db.doctor.Add(doctor); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(feedback feedback) { /*************************獲取新ID**************************/ var Fb_Desc = from m in db.feedback orderby m.f_sn descending select m.f_sn; int New_id = Fb_Desc.FirstOrDefault(); New_id++; /**********************************************************/ feedback.f_sn = New_id; feedback.f_date = DateTime.Now; feedback.f_checked = false; db.feedback.Add(feedback); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(feedback feedback) { /*************************獲取新ID**************************/ var Fb_Desc = from m in db.feedback orderby m.f_sn descending select m.f_sn; int New_id = Fb_Desc.FirstOrDefault(); New_id++; /**********************************************************/ feedback.f_sn = New_id; feedback.f_date = DateTime.Now; feedback.f_checked = false; db.feedback.Add(feedback); db.SaveChanges(); return(Content("<script>alert('感謝您的回報~!!');</script>")); }
public IHttpActionResult PostStandardProduct(StandardProduct standardProduct) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.StandardProducts.Add(standardProduct); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = standardProduct.Id }, standardProduct)); }
public void Save() { db.SaveChanges(); }
public ActionResult Create(dep_sym_ref sd) { db.dep_sym_ref.Add(sd); db.SaveChanges(); return(RedirectToAction("Index")); }