예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("LocationId,Comment,EnumLocationTypeId,HoldingId,Name,ParentId,Timestamp,VersionNumber")] Location val)
        {
            if (val.LocationId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.LocationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EnumLocationTypeId"] = new SelectList(_context.EnumLocationType, "EnumLocationTypeId", "Description", val.EnumLocationTypeId);
            ViewData["HoldingId"]          = new SelectList(_context.Holding, "HoldingId", "Postcode", val.HoldingId);
            ViewData["ParentId"]           = new SelectList(_context.Location, "LocationId", "Name", val.ParentId);
            return(View(val));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("EnumVehicleLifeEventTypeId,Comment,Description,Timestamp,VersionNumber")] EnumVehicleLifeEventType val)
        {
            if (val.EnumVehicleLifeEventTypeId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.EnumVehicleLifeEventTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(val));
        }
예제 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("MenuHeaderItemMapId,Comment,MenuHeaderId,MenuItemId,Timestamp,VersionNumber")] MenuHeaderItemMap val)
        {
            if (val.MenuHeaderItemMapId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.MenuHeaderItemMapId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MenuHeaderId"] = new SelectList(_context.MenuHeader, "MenuHeaderId", "Name", val.MenuHeaderId);
            ViewData["MenuItemId"]   = new SelectList(_context.MenuItem, "MenuItemId", "Title", val.MenuItemId);
            return(View(val));
        }
        public async Task <IActionResult> Edit(int id, [Bind("AlUserInfoId,Comment,FirstName,LastName,PrivacyConsent,Timestamp,TosConsent")] AlUserInfo val)
        {
            if (val.AlUserInfoId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.AlUserInfoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(val));
        }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("CritterImageId,Data")] CritterImage val)
        {
            if (val.CritterImageId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.CritterImageId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(val));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CritterLifeEventId,Comment,CritterId,DateTime,Description,EnumCritterLifeEventDataId,EnumCritterLifeEventTypeId,Timestamp,VersionNumber")] CritterLifeEvent val)
        {
            if (val.CritterLifeEventId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.CritterLifeEventId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CritterId"] = new SelectList(_context.Critter, "CritterId", "CritterImageId", val.CritterId);
            ViewData["EnumCritterLifeEventTypeId"] = new SelectList(_context.EnumCritterLifeEventType, "EnumCritterLifeEventTypeId", "Description", val.EnumCritterLifeEventTypeId);
            return(View(val));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PoultryClassificationId,Comment,CritterTypeId,Timestamp,VersionNumber")] PoultryClassification val)
        {
            if (val.PoultryClassificationId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.PoultryClassificationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CritterTypeId"] = new SelectList(_context.CritterType, "CritterTypeId", "Name", val.CritterTypeId);
            return(View(val));
        }
예제 #8
0
        public async Task <IActionResult> Edit(int id, [Bind("MenuItemId,Action,Comment,Controller,IconUri,RoleId,SequenceNumber,Timestamp,Title,VersionNumber")] MenuItem val)
        {
            if (val.MenuItemId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.MenuItemId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(val));
        }
예제 #9
0
        public async Task <IActionResult> Edit(int id, [Bind("HoldingId,Address,Comment,ContactId,GridReference,HoldingNumber,Postcode,RegisterForCows,RegisterForFish,RegisterForPigs,RegisterForPoultry,RegisterForSheepGoats,Timestamp,VersionNumber")] Holding val)
        {
            if (val.HoldingId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.HoldingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContactId"] = new SelectList(_context.Contact, "ContactId", "Name", val.ContactId);
            return(View(val));
        }
예제 #10
0
        public async Task <IActionResult> Edit(int id, [Bind("ProductPurchaseId,BatchNumber,Comment,Cost,DateTime,Expiry,LocationId,ProductId,SupplierId,Timestamp,VersionNumber,Volume")] ProductPurchase val)
        {
            if (val.ProductPurchaseId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.ProductPurchaseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LocationId"] = new SelectList(_context.Location, "LocationId", "Name", val.LocationId);
            ViewData["ProductId"]  = new SelectList(_context.Product, "ProductId", "Description", val.ProductId);
            ViewData["SupplierId"] = new SelectList(_context.Contact, "ContactId", "Name", val.SupplierId);
            return(View(val));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CritterImageVariantId,CritterImageModifiedId,CritterImageOriginalId,Height,Timestamp,Width")] CritterImageVariant val)
        {
            if (val.CritterImageVariantId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.CritterImageVariantId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CritterImageModifiedId"] = new SelectList(_context.CritterImage, "CritterImageId", "CritterImageId", val.CritterImageModifiedId);
            ViewData["CritterImageOriginalId"] = new SelectList(_context.CritterImage, "CritterImageId", "CritterImageId", val.CritterImageOriginalId);
            return(View(val));
        }
예제 #12
0
        public async Task <IActionResult> Edit(int id, [Bind("ContactId,Address,Comment,EmailAddress,IsCustomer,IsSupplier,Name,PhoneNumber1,PhoneNumber2,PhoneNumber3,PhoneNumber4,Timestamp,VersionNumber")] Contact val)
        {
            if (val.ContactId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.ContactId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(val));
        }
예제 #13
0
        public async Task <IActionResult> Edit(int id, [Bind("ProductId,Comment,DefaultVolume,Description,EnumProductTypeId,RequiresRefridgeration,Timestamp,VersionNumber")] Product val)
        {
            if (val.ProductId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.ProductId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EnumProductTypeId"] = new SelectList(_context.EnumProductType, "EnumProductTypeId", "Description", val.EnumProductTypeId);
            return(View(val));
        }
        /// <inheritdoc/>
        /// <exception cref="InvalidOperationException">
        /// When an attempt is made to move the transaction to a different animal.
        /// </exception>
        /// <exception cref="EntityNotFoundException{T}">
        /// When an attempt is made to update a transaction that cannot be found.
        /// </exception>
        public async Task <WeightTransaction> UpdateAsync(WeightTransaction item, CancellationToken cancellationToken)
        {
            _logger.LogInformation("Updating the weight transaction ({@Id}) for animal ({@AnimalId})", item.Id, item.AnimalId);

            var transaction = await _context.WeightTransactions
                              .FindAsync(new object[] { item.Id }, cancellationToken)
                              .ConfigureAwait(false);

            if (transaction == null)
            {
                throw new EntityNotFoundException <WeightTransaction>(item.Id);
            }

            transaction.SetValues(item);

            var changes = _context.Update(transaction);
            await _context.SaveChangesAsync(cancellationToken).ConfigureAwait(false);

            return(changes.Entity.MapToWeightTransaction());
        }
예제 #15
0
        public async Task <IActionResult> Edit(int id, [Bind("CritterId,BreedId,Comment,CritterImageId,CritterTypeId,DadCritterId,DadFurther,Flags,Gender,MumCritterId,MumFurther,Name,OwnerContactId,TagNumber,Timestamp,VersionNumber")] Critter val)
        {
            if (val.CritterId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.CritterId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BreedId"]        = new SelectList(_context.Breed, "BreedId", "Description", val.BreedId);
            ViewData["CritterImageId"] = new SelectList(_context.CritterImage, "CritterImageId", "CritterImageId", val.CritterImageId);
            ViewData["CritterTypeId"]  = new SelectList(_context.CritterType, "CritterTypeId", "Name", val.CritterTypeId);
            ViewData["DadCritterId"]   = new SelectList(_context.Critter, "CritterId", "CritterImageId", val.DadCritterId);
            ViewData["MumCritterId"]   = new SelectList(_context.Critter, "CritterId", "CritterImageId", val.MumCritterId);
            ViewData["OwnerContactId"] = new SelectList(_context.Contact, "ContactId", "Name", val.OwnerContactId);
            return(View(val));
        }