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"));
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            DbApplyRequest dbApplyRequest = db.ApplyRequests.Find(id);

            db.ApplyRequests.Remove(dbApplyRequest);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
 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));
 }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
        // 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));
        }
Esempio n. 6
0
        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"));
        }