public ActionResult DeleteConfirmed(int id) { scholarship scholarship = db.scholarships.Find(id); db.scholarships.Remove(scholarship); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,title,value,link,category,deadline")] scholarship scholarship) { if (ModelState.IsValid) { db.Entry(scholarship).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(scholarship)); }
public ActionResult Create([Bind(Include = "id,title,value,link,category,deadline")] scholarship scholarship) { if (ModelState.IsValid) { db.scholarships.Add(scholarship); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(scholarship)); }
// GET: scholarship/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } scholarship scholarship = db.scholarships.Find(id); if (scholarship == null) { return(HttpNotFound()); } return(View(scholarship)); }
public bool Create(ScholarshipDTO _Scholarship) { try { scholarship Scholarship = new scholarship() { Title = _Scholarship.Title, AddUserId = _Scholarship.AddUserId, Description = _Scholarship.Description, ImagPath = _Scholarship.ImagPath, IPAddress = _Scholarship.IPAddress, TitleInEnglish = _Scholarship.TitleInEnglish, }; _repository.Add(Scholarship); return(_unitOfWork.SaveChanges()); } catch (Exception ex) { throw ex; } }