public ActionResult Create(Report report) { try { _context.Reports.AddObject(report); _context.SaveChanges(); return RedirectToAction("Index"); } catch { return Content("Something went wrong"); } }
public ActionResult Delete(Report report) { try { _context.Reports.DeleteObject(GetReportById(report.ReportID)); _context.SaveChanges(); return RedirectToAction("Index"); } catch { return Content("Something went wrong"); } }
/// <summary> /// Erstellt ein neues Report-Objekt. /// </summary> /// <param name="reportID">Anfangswert der Eigenschaft ReportID.</param> /// <param name="operatorID">Anfangswert der Eigenschaft OperatorID.</param> /// <param name="text">Anfangswert der Eigenschaft Text.</param> /// <param name="createDate">Anfangswert der Eigenschaft CreateDate.</param> /// <param name="location">Anfangswert der Eigenschaft Location.</param> /// <param name="receivedDate">Anfangswert der Eigenschaft ReceivedDate.</param> public static Report CreateReport(global::System.Guid reportID, global::System.Guid operatorID, global::System.String text, global::System.DateTime createDate, global::System.String location, global::System.DateTime receivedDate) { Report report = new Report(); report.ReportID = reportID; report.OperatorID = operatorID; report.Text = text; report.CreateDate = createDate; report.Location = location; report.ReceivedDate = receivedDate; return report; }
/// <summary> /// Veraltete Methode zum Hinzufügen eines neuen Objekts zum EntitySet 'Reports'. Verwenden Sie stattdessen die Methode '.Add' der zugeordneten Eigenschaft 'ObjectSet<T>'. /// </summary> public void AddToReports(Report report) { base.AddObject("Reports", report); }
public ActionResult Edit(Report report) { try { var old = GetReportById(report.ReportID); old.OperatorID = report.OperatorID; old.Text = report.Text; old.CreateDate = report.CreateDate; _context.SaveChanges(); return RedirectToAction("Index"); } catch { return Content("Something went wrong"); } }