public ActionResult Create([Bind(Include = "ID,name,description,Penalties")] ViolationContent violationContent) { if (ModelState.IsValid) { db.ViolationContents.Add(violationContent); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(violationContent)); }
public ActionResult Create([Bind(Include = "ID,number,NewStudentID,NewRoomID,DateIn,DateOut,Cost")] Contract contract) { if (ModelState.IsValid) { db.Contracts.Add(contract); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(contract)); }
public ActionResult Create([Bind(Include = "ID,category,Date,IdStudent,IdViolation")] Violation violation) { if (ModelState.IsValid) { db.Violations.Add(violation); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(violation)); }
public ActionResult Create([Bind(Include = "ID,Name,Surname,Otch,PasportSer,PasportNumber,ZachetNumber,Sex,Birthday,Town")] NewStudent newStudent) { if (ModelState.IsValid) { db.NewStudents.Add(newStudent); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(newStudent)); }
public ActionResult Create([Bind(Include = "ID,NumberRoom,NumberFloor,Count,Chear")] LeaveRooms leaveRooms) { if (ModelState.IsValid) { db.LeaveRooms.Add(leaveRooms); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(leaveRooms)); }
public ActionResult Create([Bind(Include = "ID,floor,NameRoom")] Rooms rooms) { if (ModelState.IsValid) { db.Rooms.Add(rooms); db.SaveChanges(); HttpStatusCode code = SendToAPI(rooms); switch (code) { case HttpStatusCode.NoContent: { return(RedirectToAction("Index")); } default: { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } } } return(View(rooms)); }