예제 #1
0
        //public async Task<IActionResult> Edit(int id, [Bind("Id,Name,ContactName,Phone,CreatedBy,Created,ModifiedBy,Modified,RowVersion")] ServiceCompanies serviceCompanies)
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ContactName,Phone")] ServiceCompany serviceCompanies)
        {
            if (id != serviceCompanies.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(serviceCompanies);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ServiceCompaniesExists(serviceCompanies.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(serviceCompanies));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Location location)
        {
            if (id != location.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(location);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocationExists(location.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }
예제 #3
0
        //public async Task<IActionResult> Edit(int id, [Bind("Id,MaintenanceDate,Notes,IsCompleted,CreatedBy,Created,ModifiedBy,Modified,RowVersion,MaintanceLogAsset")] MaintenanceLogs maintenanceLogs)
        public async Task <IActionResult> Edit(int id, [Bind("Id,MaintenanceDate,Notes,IsCompleted,MaintanceLogAsset")] MaintenanceLog maintenanceLogs)
        {
            if (id != maintenanceLogs.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(maintenanceLogs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaintenanceLogsExists(maintenanceLogs.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MaintanceLogAsset"] = new SelectList(_context.Assets, "Id", "Name", maintenanceLogs.MaintanceLogAsset);
            return(View(maintenanceLogs));
        }
예제 #4
0
        //public async Task<IActionResult> Edit(int id, [Bind("Id,Name,Make,Model,SerialNumber,Url,PurchaseDate,PurchasePrice,Quantity,DrawingsAvailable,Notes,CreatedBy,Created,ModifiedBy,Modified,RowVersion,CategoryAsset,LocationAsset,AssetServiceCompany1")] Assets assets)
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Make,Model,SerialNumber,Url,PurchaseDate,PurchasePrice,Quantity,DrawingsAvailable,Notes,CategoryAsset,LocationAsset,AssetServiceCompany1")] Asset assets)
        {
            if (id != assets.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(assets);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AssetsExists(assets.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AssetServiceCompany1"] = new SelectList(_context.ServiceCompanies, "Id", "Name", assets.AssetServiceCompany1);
            ViewData["CategoryAsset"]        = new SelectList(_context.Categories, "Id", "Name", assets.CategoryAsset);
            ViewData["LocationAsset"]        = new SelectList(_context.Locations, "Id", "Name", assets.LocationAsset);
            return(View(assets));
        }
예제 #5
0
        //public async Task<IActionResult> Edit(int id, [Bind("Id,Image,Caption,IsDefaultPicture,CreatedBy,Created,ModifiedBy,Modified,RowVersion,PictureAsset,PictureMaintanceLog")] Pictures pictures)
        public async Task <IActionResult> Edit(int id, [Bind("Id,Image,Caption,IsDefaultPicture,PictureAsset,PictureMaintanceLog")] Picture pictures)
        {
            if (id != pictures.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pictures);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PicturesExists(pictures.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PictureAsset"]        = new SelectList(_context.Assets, "Id", "Name", pictures.PictureAsset);
            ViewData["PictureMaintanceLog"] = new SelectList(_context.MaintenanceLogs, "Id", "Id", pictures.PictureMaintanceLog);
            return(View(pictures));
        }