public async Task <IActionResult> PutBacluong(int id, Bacluong bacluong)
        {
            if (id != bacluong.MaBac)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> Edit(int id, [Bind("Cost,Name,Id,Version")] Product product)
        {
            if (id != product.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(product);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductExists(product.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(product));
        }
Exemple #3
0
        public async Task <IActionResult> PutFlightSet(int id, FlightSet flightSet)
        {
            if (id != flightSet.FlightNo)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #4
0
        public async Task <Therapy> AddTherapy(Therapy therapy)
        {
            if (await TherapyExistsByAdl(therapy.Adl))
            {
                throw new TherapyAdlAlreadyExistException();
            }
            if (await TherapyExistsByAbbreviation(therapy.Abbreviation))
            {
                throw new TherapyAbbreviationAlreadyExistException();
            }
            if (!await TherapyMainExists(therapy.Type))
            {
                throw new TherapyMainDoesNotExistException();
            }

            therapy.Active = true;

            _context.Therapy.Add(therapy);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                throw;
            }

            return(therapy);
        }
        public async Task <IActionResult> PutProductType(string id, ProductType productType)
        {
            if (id != productType.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #6
0
        public async Task <IActionResult> PutAccounts(string id, Accounts accounts)
        {
            if (id != accounts.Username)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #7
0
        public async Task <TherapyMain> AddTherapyMain(TherapyMain therapyMain)
        {
            if (await TherapyMainExistsByType(therapyMain.Type))
            {
                throw new TherapyMainTypeAlreadyExistsException();
            }
            if (await TherapyMainExistsByAbbreviation(therapyMain.Abbreviation))
            {
                throw new TherapyMainTypeAbbreviationAlreadyExistsException();
            }

            therapyMain.Active = true;

            _context.TherapyMain.Add(therapyMain);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                throw;
            }

            return(therapyMain);
        }
        public async Task <IActionResult> PutSubmmit(int id, Submmit submmit)
        {
            if (id != submmit.Form_no)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutSupplier(Guid id, Supplier supplier)
        {
            if (id != supplier.SupplierId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutBillSaleDetail(string id, BillSaleDetail billSaleDetail)
        {
            if (id != billSaleDetail.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #11
0
        public async Task <IActionResult> PutClass(string id, Classes classs)
        {
            if (id != classs.ClassId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutIndicatorDataCcyName(int id, IndicatorDataCcyName indicatorDataCcyName)
        {
            if (id != indicatorDataCcyName.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutVehiclePartsData(int id, VehiclePartsData vehiclePartsData)
        {
            if (id != vehiclePartsData.VehicleId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutPartsAvailibility(int id, PartsAvailibility partsAvailibility)
        {
            if (id != partsAvailibility.PartId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #15
0
        public async Task <IActionResult> UpdateCargo(Guid id, Cargo cargo)
        {
            if (id != cargo.CargoId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #16
0
        public async Task <Permission> AddPermission(Permission permission)
        {
            if (!_validRoles.Contains(permission.Role))
            {
                throw new PermissionRoleIsInvalidException("Role: " + permission.Role + " is not valid");
            }
            if (!await UserExists(permission.UserId))
            {
                throw new UserDoesNotExistException("User with id: " + permission.UserId + " does not exist");
            }
            if (await PermissionExists(permission))
            {
                throw new PermissionAlreadyExistsException();
            }

            _context.Permission.Add(permission);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                throw;
            }

            return(permission);
        }
        public async Task <IActionResult> PutAnswerDetails(Guid id, AnswerDetails answerDetails)
        {
            if (id != answerDetails.AnswerId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutServiceHistory(int id, ServiceHistory serviceHistory)
        {
            if (id != serviceHistory.VehicleId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutCgiShift(int id, CgiShift cgiShift)
        {
            if (id != cgiShift.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #20
0
        public async Task <IActionResult> PutImportInvoice(string id, ImportInvoice importInvoice)
        {
            if (id != importInvoice.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> Edit(int id, [Bind("IdCoding,Title")] Coding coding)
        {
            if (id != coding.IdCoding)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(coding);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CodingExists(coding.IdCoding))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(coding));
        }
Exemple #22
0
        public async Task <IActionResult> PutPassengerSet(int id, PassengerSet passengerSet)
        {
            if (id != passengerSet.PersonId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #23
0
        public async Task <IActionResult> PutRestaurante([FromRoute] int id, [FromBody] RestauranteDTO restaurante)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != restaurante.IdRestaurante)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutWishlist(Guid id, Wishlist wishlist)
        {
            if (id != wishlist.WishlistId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutChucvu(int id, Chucvu chucvu)
        {
            if (id != chucvu.MaCv)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #26
0
        public async Task <IActionResult> PutBomontrungtam(int id, Bomontrungtam bomontrungtam)
        {
            if (id != bomontrungtam.Mabm)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #27
0
        public async Task <IActionResult> PutPlans(int id, Plans plans)
        {
            if (id != plans.PlanId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutGiangvien(int id, Giangvien giangvien)
        {
            if (id != giangvien.MaGv)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutDbuser(string id, Dbuser dbuser)
        {
            if (id != dbuser.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemple #30
0
        public async Task <IActionResult> PutEmployees(String id, Employees employees)
        {
            if (id != employees.EmployeeId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }