예제 #1
0
        public async Task <ActionResult> Edit([Bind(Include = "TourPackageID,TourPackageTitle,Highlights,InclusionExclusion,TourDestination,SpecialNotes,TourCostPrice,TourSalesPrice,TourDiscountPrice,TotalNights,HotelStar,HotelInUse,DayWiseItienary,TearmsAndConditions,Allotment,Adults,Childrens,CreatedOn,DepartingDate,ValidityDate,DayOne,DayTwo,DayThree,DayFour,DayFive,DaySix,DaySeven,DayEight,DayNine,DayTen")] TourPackage tourPackage)
        {
            if (ModelState.IsValid)
            {
                //New Files
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    var file = Request.Files[i];

                    if (file != null && file.ContentLength > 0)
                    {
                        var        fileName   = Path.GetFileName(file.FileName);
                        FileDetail fileDetail = new FileDetail()
                        {
                            FileName      = fileName,
                            Extension     = Path.GetExtension(fileName),
                            FileDetailsId = Guid.NewGuid(),
                            TourPackageId = tourPackage.TourPackageID
                        };
                        var path = Path.Combine(Server.MapPath("~/Images/packageImg/"), fileDetail.FileDetailsId + fileDetail.Extension);
                        file.SaveAs(path);
                        db.Entry(fileDetail).State = EntityState.Added;
                    }
                }

                //tourPackage.ModifiedOn = DateTime.Now;
                db.Entry(tourPackage).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(tourPackage));
        }
예제 #2
0
        public async Task <ActionResult> Edit([Bind(Include = "TourPackageID,TourPackageTitle,Highlights,InclusionExclusion,TourDestination,SpecialNotes,TourCostPrice,TourSalesPrice,TourDiscountPrice,TotalNights,HotelStar,HotelInUse,DayWiseItienary,TearmsAndConditions,Allotment,Adults,Childrens,CreatedOn,DepartingDate,ValidityDate,DayOne,DayTwo,DayThree,DayFour,DayFive,DaySix,DaySeven,DayEight,DayNine,DayTen")] TourPackage tourPackage)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tourPackage).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(tourPackage));
        }