public string AppEdit(string json)
        {
            try
            {
                var       customer  = JObject.Parse(json);
                Customers customers = new Customers()
                {
                    CustomerId     = Convert.ToInt32(customer["customerId"]),
                    IdNumber       = customer["idNumber"].ToString(),
                    IdDocumentName = Convert.ToInt32(customer["idDocumentName"]),
                    City           = customer["city"].ToString(),
                    PhoneNumber    = customer["phoneNumber"].ToString(),
                    Email          = customer["email"].ToString(),
                    Address        = customer["address"].ToString(),
                    DateOfBirth    = DateTime.Parse(customer["dateOfBirth"].ToString()),
                    FirstName      = customer["firstName"].ToString(),
                    SecondName     = customer["secondName"].ToString()
                };

                _context.Update(customers);
                _context.SaveChangesAsync();
            }
            catch
            {
            }

            return("Edited");
        }
        public async Task <IActionResult> Edit(int id, [Bind("VatId,Vat1")] Vat vat)
        {
            if (id != vat.VatId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vat);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VatExists(vat.VatId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vat));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ColourId,Colour")] Colours colours)
        {
            if (id != colours.ColourId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(colours);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ColoursExists(colours.ColourId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(colours));
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, [Bind("WoodId,Wood1")] Wood wood)
        {
            if (id != wood.WoodId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(wood);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WoodExists(wood.WoodId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(wood));
        }
        public async Task <IActionResult> Edit(int id, [Bind("DetailId,AccessoryId,OrderId")] Details details)
        {
            if (id != details.DetailId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(details);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DetailsExists(details.DetailId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(details));
        }
Beispiel #6
0
        public async Task <IActionResult> Edit(int id, [Bind("BoatId,Model,BoatType,NumberOfRowers,Colour,Wood,BasePrice,Vat")] Boat boat)
        {
            if (id != boat.BoatId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(boat);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BoatExists(boat.BoatId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(boat));
        }
Beispiel #7
0
        public async Task <IActionResult> Edit(int id, [Bind("ProductionProcessId,ProductionProcess1")] ProductionProcess productionProcess)
        {
            if (id != productionProcess.ProductionProcessId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productionProcess);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductionProcessExists(productionProcess.ProductionProcessId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(productionProcess));
        }
        public async Task <IActionResult> Edit(int id, [Bind("SalesPersonId,FirstName,SecondName")] SalesPerson salesPerson)
        {
            if (id != salesPerson.SalesPersonId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(salesPerson);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SalesPersonExists(salesPerson.SalesPersonId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(salesPerson));
        }
        public async Task <IActionResult> Edit(int id, [Bind("AccessoryId1,AccName,DescriptionOfAccessory,Price,Vat,Inventory,PartnerId")] AccessoryId accessoryId)
        {
            if (id != accessoryId.AccessoryId1)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accessoryId);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccessoryIdExists(accessoryId.AccessoryId1))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(accessoryId));
        }
Beispiel #10
0
        public async Task <IActionResult> Edit(int id, [Bind("BoatTypeId,BoatType1")] BoatType boatType)
        {
            if (id != boatType.BoatTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(boatType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BoatTypeExists(boatType.BoatTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(boatType));
        }
        public async Task <IActionResult> Edit(int id, [Bind("OrderId,Date,SelesPersonId,CustomerId,BoatId,DeliveryAddress,City")] Orders orders)
        {
            if (id != orders.OrderId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(orders);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrdersExists(orders.OrderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(orders));
        }
        public async Task <IActionResult> Edit(int id, [Bind("DocumentNameId,DocumentName1")] DocumentName documentName)
        {
            if (id != documentName.DocumentNameId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(documentName);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DocumentNameExists(documentName.DocumentNameId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(documentName));
        }
Beispiel #13
0
        public async Task <IActionResult> Edit(int id, [Bind("PartnerId,Name,Address,City")] Partners partners)
        {
            if (id != partners.PartnerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(partners);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PartnersExists(partners.PartnerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(partners));
        }
        public async Task <IActionResult> Edit(int id, [Bind("FitId,AccessoryId,BoatId")] Fit fit)
        {
            if (id != fit.FitId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(fit);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FitExists(fit.FitId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(fit));
        }
Beispiel #15
0
        public string SetProductionProcess(int idContract, int idProductionProcess)
        {
            try
            {
                Contract contract = _context.Contract.Find(idContract);
                if (contract != null)
                {
                    contract.ProductionProcess = idProductionProcess;
                    _context.Update(contract);
                    _context.SaveChanges();
                    return("Contract updated");
                }

                return("Contract is not found");
            }
            catch
            {
                return("Error");
            }
        }
Beispiel #16
0
 public async Task <IActionResult> Edit(string id, [Bind("Username,Password,UserType,CustomerId")] Auth auth)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(auth);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!AuthExists(auth.Username))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(auth));
 }