public ActionResult Print(HttpPostedFileBase file) { if (file != null && file.ContentLength > 0) { var dto = Helper.LoadFromStream(file.InputStream); using (var db = new ApplicationDbContext()) { var row = new DbApplyRequest { FullName = dto.FullName, Age = dto.Age, Filled = dto.Filled, }; /*row.WayPoints = new Collection<DbWayPoint>(); * * foreach (var wpDto in dto.WayPoints) * { * row.WayPoints.Add(new DbWayPoint * { * Address = wpDto.Address, * Type = (Models.WayPointType)(int)wpDto.Type * }); * }*/ db.ApplyRequests.Add(row); db.SaveChanges(); } return(View(dto)); } return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { DbApplyRequest dbApplyRequest = db.ApplyRequests.Find(id); db.ApplyRequests.Remove(dbApplyRequest); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id, Filled, FullName, Citizenship, Age, Height, Weight, Position, WorkingLeg, AgeStartCareer,CountTraums, TimeTraums")] DbApplyRequest dbApplyRequest) { if (ModelState.IsValid) { db.Entry(dbApplyRequest).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dbApplyRequest)); }
public ActionResult Create([Bind(Include = "Id, Filled, FullName, Age, Citizenship, Position, WorkingLeg, Height, Weight, AgeStartCareer, CountTraums, TimeTraums, TraumаNow, Traums, Strength1, Strength2, Strength3,WeakSides1, WeakSides2, WeakSides3")] DbApplyRequest dbApplyRequest) { if (ModelState.IsValid) { db.ApplyRequests.Add(dbApplyRequest); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dbApplyRequest)); }
// GET: DbApplyRequests/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DbApplyRequest dbApplyRequest = db.ApplyRequests.Find(id); if (dbApplyRequest == null) { return(HttpNotFound()); } return(View(dbApplyRequest)); }
public ActionResult Print(HttpPostedFileBase file) { if (file != null && file.ContentLength > 0) { var dto = Helper.LoadFromStream(file.InputStream); using (var db = new ApplicationDbContext()) { var row = new DbApplyRequest { FullName = dto.FullName, Age = dto.Age, Citizenship = dto.Citizenship, Weight = dto.Weight, Height = dto.Height, Position = (F.Web.Models.Position)dto.Position, WorkingLeg = (F.Web.Models.WorkingLeg)dto.WorkingLeg, Filled = dto.Filled, AgeStartCareer = dto.AgeStartCareer, CountTraums = dto.CountTraums, TimeTraums = dto.TimeTraums, TraumаNow = dto.TraumаNow, Traums = dto.Traums, Strength1 = dto.Strength1, Strength2 = dto.Strength2, Strength3 = dto.Strength3, WeakSides1 = dto.WeakSides1, WeakSides2 = dto.WeakSides2, WeakSides3 = dto.WeakSides3, }; /*row.Trauma = new Collection <DbTrauma>(); * * foreach (var wp in dto.Traums) * { * row.Trauma.Add(new DbTrauma * { * TraumаNow = wp., * CountTraums = wp. * //Type = (Models.WayPointType)(int)wpDto.Type * });*/ db.ApplyRequests.Add(row); db.SaveChanges(); } return(View(dto)); } return(RedirectToAction("Index")); }