// GET: Repositories/Create public ActionResult Create() { ViewBag.RepositoryTypeId = new SelectList(db.RepositoryTypes, "Id", "Name"); //ViewBag.PriceEstimate = new SelectList(db.Repositories.Include(x=>x.PriceEstimateId)); DomainModel.Repository.Repository repository = new DomainModel.Repository.Repository(); return(PartialView(viewName: "Create", model: repository)); }
public ActionResult DeleteConfirmed(int id) { DomainModel.Repository.Repository repository = db.Repositories.Find(id); db.Repositories.Remove(repository); db.SaveChanges(); return(Json(new { success = true })); }
public ActionResult Edit([Bind(Include = "Id,Code,Name,RepositoryTypeId,PriceEstimateId")] DomainModel.Repository.Repository repository) { if (ModelState.IsValid) { db.Entry(repository).State = EntityState.Modified; db.SaveChanges(); return(Json(new { success = true })); } ViewBag.RepositoryTypeId = new SelectList(db.RepositoryTypes, "Id", "Name", repository.RepositoryTypeId); return(PartialView(viewName: "Edit", model: repository)); }
// GET: Repositories/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DomainModel.Repository.Repository repository = db.Repositories.Find(id); if (repository == null) { return(HttpNotFound()); } return(PartialView(viewName: "Delete", model: repository)); }
public ActionResult Create([Bind(Include = "Id,Code,Name,RepositoryTypeId,PriceEstimateId")] DomainModel.Repository.Repository repository) { if (ModelState.IsValid) { db.Repositories.Add(repository); db.SaveChanges(); //return RedirectToAction("Index"); return(Json(new { success = true })); } ViewBag.RepositoryTypeId = new SelectList(db.RepositoryTypes, "Id", "Name", repository.RepositoryTypeId); return(PartialView(viewName: "Create", model: repository)); }
// GET: Repositories/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DomainModel.Repository.Repository repository = db.Repositories.Find(id); if (repository == null) { return(HttpNotFound()); } ViewBag.RepositoryTypeId = new SelectList(db.RepositoryTypes, "Id", "Name", repository.RepositoryTypeId); return(PartialView(viewName: "Edit", model: repository)); }