public async Task <IActionResult> PutVisitor(int id, Visitor visitor)
        {
            if (id != visitor.VisitorId)
            {
                return(BadRequest());
            }

            _context.Entry(visitor).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VisitorExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#2
0
        public void UpdateState(List <int> ids, bool status)
        {
            HMSContext context = new HMSContext();

            if (status == true)
            {
                foreach (var t in ids)
                {
                    var obj = context.Accomodations.Find(t);
                    obj.IsHold = true;
                    context.Entry(obj).State = EntityState.Modified;
                    context.SaveChanges();
                }
            }
            else
            {
                foreach (var t in ids)
                {
                    var obj = context.Accomodations.Find(t);
                    obj.IsHold = false;
                    context.Entry(obj).State = EntityState.Modified;
                    context.SaveChanges();
                }
            }
        }
示例#3
0
        //Function edit
        public bool UpdateAccomodationPackage(AccomodationPackage accomodationPackage)
        {
            var context = new HMSContext();

            context.Entry(accomodationPackage).State = System.Data.Entity.EntityState.Modified;
            return(context.SaveChanges() > 0);
        }
        public bool UpdateAccomodation(Accomodation accomodation)
        {
            var _context = new HMSContext();

            _context.Entry(accomodation).State = System.Data.Entity.EntityState.Modified;
            return(_context.SaveChanges() > 0);
        }
示例#5
0
        public async Task <IActionResult> PutLogin(int id, Login login)
        {
            if (id != login.LoginId)
            {
                return(BadRequest());
            }

            _context.Entry(login).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LoginExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#6
0
        public bool UpdateAccommodationType(AccommodationType model)
        {
            var context = new HMSContext();

            context.Entry(model).State = System.Data.Entity.EntityState.Modified;
            return(context.SaveChanges() > 0);
        }
        public bool UpdateAccomodationType(AccomodationType accomodationType)
        {
            var context = new HMSContext();

            context.Entry(accomodationType).State = EntityState.Modified;
            return(context.SaveChanges() > 0);
        }
示例#8
0
        public bool DeleteAccomodationType(AccomodationType accomodationType)
        {
            var context = new HMSContext();

            context.Entry(accomodationType).State = System.Data.Entity.EntityState.Deleted;
            return(context.SaveChanges() > 0);
        }
        public bool DeleteAccomodationPackage(AccomodationPackage accomodationPackage)
        {
            var _context = new HMSContext();

            _context.Entry(accomodationPackage).State = System.Data.Entity.EntityState.Deleted;
            return(_context.SaveChanges() > 0);
        }
        public bool UpdateAccomadations(Accomadation accomadation)
        {
            var context = new HMSContext();

            context.Entry(accomadation).State = System.Data.Entity.EntityState.Modified; // modify the accomadation type

            return(context.SaveChanges() > 0);
        }
示例#11
0
        public bool DeleteAccomodationPackage(AccomodationPackages accomodationPackages)
        {
            var context = new HMSContext();

            context.Entry(accomodationPackages).State = EntityState.Deleted;

            return(context.SaveChanges() > 0);
        }
        public bool DeleteAccomadations(Accomadation accomadation)
        {
            var context = new HMSContext();

            context.Entry(accomadation).State = System.Data.Entity.EntityState.Deleted; // delete accomadation type

            return(context.SaveChanges() > 0);
        }
示例#13
0
        public bool UpdateAccomodationType(AccomodationType accomodationType)
        {
            var dbContext = new HMSContext();

            dbContext.Entry(accomodationType).State = System.Data.Entity.EntityState.Modified;

            return(dbContext.SaveChanges() > 0);
        }
        public bool DeleteAccomodationPackage(AccomodationPackage accomodationPackage)
        {
            var context = new HMSContext();
            var existingAccomodationPackage = context.AccomodationPackages.Find(accomodationPackage.Id);

            context.AccomodationPackagePictures.RemoveRange(existingAccomodationPackage.AccomodationPackagePictures);
            context.Entry(existingAccomodationPackage).State = System.Data.Entity.EntityState.Deleted;
            return(context.SaveChanges() > 0);
        }
 public bool UpdateAccommodationPackage(AccommodationPackage accommodationPackage)
 {
     var context = new HMSContext();
     var exitingAccommodationPackage = context.AccommodationPackages.Find(accommodationPackage.ID);
     context.AccommodationPackagePictures.RemoveRange(exitingAccommodationPackage.AccommodationPackagePictures);
     context.Entry(exitingAccommodationPackage).CurrentValues.SetValues(accommodationPackage);
     context.AccommodationPackagePictures.AddRange(accommodationPackage.AccommodationPackagePictures);
     return context.SaveChanges() > 0;
 }
示例#16
0
 public ActionResult Edit([Bind(Include = "Id,Name,Description")] AccomodationType accomodationType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(accomodationType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(accomodationType));
 }
示例#17
0
 public bool UpdateAccomodation(Accomodation model)
 {
     using (var context = new HMSContext()) {
         var existingAccomodation = context.Accomodations.Where(x => x.ID == model.ID).Include(y => y.AccomodationPictures).FirstOrDefault();
         context.AccomodationPictures.RemoveRange(existingAccomodation.AccomodationPictures);
         context.Entry(existingAccomodation).CurrentValues.SetValues(model);
         context.AccomodationPictures.AddRange(model.AccomodationPictures);
         return(context.SaveChanges() > 0);
     }
 }
示例#18
0
        public bool DeleteAccomodations(int id)
        {
            var context = new HMSContext();
            var obj     = context.Accomodations.Find(id);

            context.Entry(obj).State = EntityState.Deleted;
            var result = context.SaveChanges() > 0;

            return(result);
        }
示例#19
0
 public ActionResult Edit(Linkhay linkHay)
 {
     if (ModelState.IsValid)
     {
         objContext.Entry(linkHay).State = EntityState.Modified;
         objContext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(linkHay));
 }
 public bool UpdateAccomodationPackages(AccomodationPackage model)
 {
     using (var context = new HMSContext())
     {
         var existingAccomodationPackage = context.AccomodationPackages.Find(model.ID);
         context.AccomodationPackagePictures.RemoveRange(existingAccomodationPackage.AccomodationPackagePictures);
         context.Entry(existingAccomodationPackage).CurrentValues.SetValues(model);
         context.AccomodationPackagePictures.AddRange(model.AccomodationPackagePictures);
         return(context.SaveChanges() > 0);
     }
 }
示例#21
0
        public bool UpdateAddionalChargesStatus(int id, int status)
        {
            HMSContext context = new HMSContext();

            var obj = context.BookingAdditionalFees.Find(id);

            obj.Status = status;
            context.Entry(obj).State = EntityState.Modified;
            var result = context.SaveChanges() > 0;

            return(result);
        }
        public bool DeleteAccomadationPackages(AccomadationPackage accomadationPackage)
        {
            var context = new HMSContext();

            var existingAccomadationpackage = context.AccomadationPackage.Find(accomadationPackage.ID); // find existing accomadatioPackages

            // remove exisitng AccomadationPackage Pictures from db AccomadationPackagePictures
            context.AccomadationPackagePicture.RemoveRange(existingAccomadationpackage.AccomadationPackagePictures);

            context.Entry(existingAccomadationpackage).State = System.Data.Entity.EntityState.Deleted; // delete accomadation package

            return(context.SaveChanges() > 0);
        }
示例#23
0
        //Update
        public bool UpdateAccomodation(Accomodation accomodation)
        {
            var context = new HMSContext();

            var existingAccomodation = context.Accomodations.Find(accomodation.ID);

            context.AccomodationPictures.RemoveRange(existingAccomodation.AccomodationPictures);
            context.Entry(existingAccomodation).CurrentValues.SetValues(accomodation);
            context.AccomodationPictures.AddRange(accomodation.AccomodationPictures);

            // context.Entry(accomodation).State = System.Data.Entity.EntityState.Modified;

            return(context.SaveChanges() > 0);
        }
示例#24
0
        public bool UpdateAccomodationTypes(AccomodationType accomodationType)
        {
            var context = new HMSContext();
            var obj     = context.AccomodationTypes.Find(accomodationType.Id);

            obj.Name        = accomodationType.Name;
            obj.Description = accomodationType.Description;


            context.Entry(obj).State = EntityState.Modified;

            var result = context.SaveChanges() > 0;

            return(result);
        }
示例#25
0
        public bool UpdateAccomodationPackage(AccomodationPackage accomodationPackage)
        {
            var context = new HMSContext();
            //iskay krny Ki waaja ye hai ki context dispose horha tha q ki ham accomdationpkgid ko 2 jaga use kr rhy thy yani
            //2 context mai to vo dusry ma akar dispose horha tha iswaja sy ye existingAccomodationPackage ka scene kia hai
            //isky zareye phly accomodation find ki phr id sy phr update krdya mgr jo List hain unhen nahe
            var existingAccomodationPackage = context.AccomodationPackage.Find(accomodationPackage.ID);

            context.AccomodationPackagePictures.RemoveRange(existingAccomodationPackage.AccomodationPackagePictures);

            context.Entry(existingAccomodationPackage).CurrentValues.SetValues(accomodationPackage);

            context.AccomodationPackagePictures.AddRange(accomodationPackage.AccomodationPackagePictures);

            return(context.SaveChanges() > 0);
        }
        public bool UpdateAccomadationPackages(AccomadationPackage accomadationPackage)
        {
            var context = new HMSContext();

            var existingAccomadationpackage = context.AccomadationPackage.Find(accomadationPackage.ID); // find existing accomadatioPackages

            // remove exisitng AccomadationPackage Pictures from db AccomadationPackagePictures
            context.AccomadationPackagePicture.RemoveRange(existingAccomadationpackage.AccomadationPackagePictures);

            // set the current values for existingAccomadationpackage, this does not include other objects such as AccomadationPackagePicture
            context.Entry(existingAccomadationpackage).CurrentValues.SetValues(accomadationPackage);

            context.AccomadationPackagePicture.AddRange(accomadationPackage.AccomadationPackagePictures); // add AccomadationPackagePictures from param accomadationPackage to db AccomadationPackagePicture

            return(context.SaveChanges() > 0);
        }
示例#27
0
        public bool UpdateAccomodationPackages(AccomodationPackage accomodationPackage)
        {
            var context = new HMSContext();
            var obj     = context.AccomodationPackages.Find(accomodationPackage.Id);


            context.AccomodationPackagePictures.RemoveRange(obj.AccomodationPackagePictures);
            context.AccomodationPackagePictures.AddRange(accomodationPackage.AccomodationPackagePictures);



            obj.Name               = accomodationPackage.Name;
            obj.NoOfRoom           = accomodationPackage.NoOfRoom;
            obj.FeePerNight        = accomodationPackage.FeePerNight;
            obj.AccomodationTypeId = accomodationPackage.AccomodationTypeId;

            //obj.AccomodationPackagePictures = accomodationPackage.AccomodationPackagePictures;
            context.Entry(obj).State = EntityState.Modified;

            var result = context.SaveChanges() > 0;

            return(result);
        }
示例#28
0
 public T Update(T obj)
 {
     dbSet.Attach(obj);
     _context.Entry(obj).State = EntityState.Modified;
     return(obj);
 }
 public bool UpdateAccomodationType(AccomodationType model)
 {
     _Context.Entry(model).State = System.Data.Entity.EntityState.Modified;
     return(_Context.SaveChanges() > 0);
 }
示例#30
0
 //edit accommodation type and save it to db
 public bool UpdateAccommodationType(AccommodationType formModelAccommodationType)
 {
     context.Entry(formModelAccommodationType).State = System.Data.Entity.EntityState.Modified;
     return(context.SaveChanges() > 0);
 }