예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FolderName,BoxID,CustDataCIFNo")] Folder folder)
        {
            if (id != folder.ID)
            {
                return(NotFound());
            }
            try
            {
                baseAsyncFolderRepo.Update(folder);
                await baseAsyncFolderRepo.SaveAsync();

                return(RedirectToAction("Index", new RouteValueDictionary(new { controller = "Box", action = "Index", id = folder.BoxID })));
            }
            catch (DbUpdateException /* dex */)
            {
                //Log the error (uncomment dex variable name after DataException and add a line here to write a log.
                ModelState.AddModelError(string.Empty, "Unable to save changes. Try again, and if the problem persists contact your system administrator.");
            }


            return(View(folder));
        }
예제 #2
0
        public async Task <ActionResult> Edit(int id, [Bind("ID,BoxDescription,DateBoxCreated,BoxCreatedBy,BoxCreatorID")] Box box)
        {
            if (id != box.ID)
            {
                return(NotFound());
            }
            try
            {
                baseAsyncBoxRepo.Update(box);
                await baseAsyncBoxRepo.SaveAsync();

                return(RedirectToAction(nameof(Index)));
            }
            catch (DbUpdateException /* dex */)
            {
                //Log the error (uncomment dex variable name after DataException and add a line here to write a log.
                ModelState.AddModelError(string.Empty, "Unable to save changes. Try again, and if the problem persists contact your system administrator.");
            }

            PopulateBoxCreatorDropDownList(box.BoxCreatorID);
            return(View(box));
        }