Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,name,description,value,userDonatedId")] Item item)
        {
            if (HttpContext.Session.GetString("username") == null)
            {
                return(RedirectToAction("", ""));
            }
            if (id != item.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(item);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ItemExists(item.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(item));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,userSenderId,organizationReceiverId,amount")] Payment payment)
        {
            if (id != payment.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(payment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PaymentExists(payment.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(payment));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,name,UserAccount,dateOfFounding,description,creditCardNumber")] Organization organization)
        {
            if (HttpContext.Session.GetString("username") == null)
            {
                return(RedirectToAction("", ""));
            }
            if (id != organization.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(organization);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrganizationExists(organization.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(organization));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,firstName,lastName,gender,dateOfBirth")] User user)
        {
            Guid idOfLoggedAccount = Guid.Parse(HttpContext.Session.GetString("idOfLoggedUserAccount"));

            //user.Id = id;
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    user.UserAccount = idOfLoggedAccount;

                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,name,description,actionType,organizationId,creationDateTime,startDateTime,endDateTime")] CharityAction charityAction)
        {
            if (id != charityAction.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(charityAction);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CharityActionExists(charityAction.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(charityAction));
        }