Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CountryId, Description, JenkisAddress, GitAddress, ProvisionGitAddress, NexusFrontEndAddress, NexusProductAddress, BiometricProductAddress, Notes, Active")] Project project)
        {
            if (id != project.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(project);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(project.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Country, "Id", "Id", project.CountryId);
            return(View(project));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name, Active")] Region Region)
        {
            if (id != Region.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(Region);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegionExists(Region.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(Region));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("id,text,score,gameId")] Review review)
        {
            if (id != review.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(review);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ReviewExists(review.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["gameId"] = new SelectList(_context.Games, "id", "id", review.gameId);
            return(View(review));
        }
Пример #4
0
 public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Author,Genre,URL,Album")] Song song)
 {
     if (id != song.ID)
     {
         return(NotFound());
     }
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(song);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!SongExists(song.ID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(song));
 }
        public async Task <IActionResult> Edit(int id, [Bind("id,name")] Developer developer)
        {
            if (id != developer.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(developer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DeveloperExists(developer.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(developer));
        }
Пример #6
0
        public async Task <IActionResult> Edit(int id, [Bind("id,name,mail,password,shoppingCartId")] User user)
        {
            if (id != user.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
        public async Task <IActionResult> Edit(int id, [Bind("OrderID,CustomerID,FlowerID")] Order order)
        {
            if (id != order.OrderID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(order);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrderExists(order.OrderID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["CustomerID"] = new SelectList(_context.Customers, "CustomerID", "CustomerID", order.CustomerID);
            ViewData["FlowerID"]   = new SelectList(_context.Flowers, "FlowerID", "FlowerID", order.FlowerID);
            return(View(order));
        }
Пример #8
0
        public async Task <IActionResult> Edit(int id, [Bind("id,name,description,imageUrl,price,developerId,publisherId")] Game game)
        {
            if (id != game.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(game);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GameExists(game.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["developerId"] = new SelectList(_context.Developer, "id", "id", game.developerId);
            ViewData["publisherId"] = new SelectList(_context.Publisher, "id", "id", game.publisherId);
            return(View(game));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CustomerID,LastName,FirstMidName,RegistrationDate")] Customer customer)
        {
            if (id != customer.CustomerID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(customer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CustomerExists(customer.CustomerID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(customer));
        }
Пример #10
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CountryId")] Project project)
        {
            if (id != project.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(project);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProjectExists(project.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CountryId"] = new SelectList(_context.Country, "Id", "Id", project.CountryId);
            return(View(project));
        }
        public void UpdateTransactionStatus(long recordId, short transactionStatus, string comment)
        {
            var record = _context.RemitRecord.SingleOrDefault(x => x.Id == recordId);

            _context.Entry(record).Reference(record => record.ToCurrency).Load();
            var exchangeRate = _context.ExchangeRate.SingleOrDefault(x => x.CurrencyName.Equals(record.ToCurrency.CurrencyName));
            var originalTransactionStatus = record.TransactionStatus;

            if (record == null)
            {
                return;
            }
            record.TransactionStatus       = transactionStatus;
            record.TransactionExchangeRate = exchangeRate.Rate;
            RemitAdminReviewLog reviewLog = new RemitAdminReviewLog()
            {
                RemitRecordId         = recordId,
                FromTransactionStatus = originalTransactionStatus,
                ToTransactionStatus   = transactionStatus,
                Note = comment
            };

            record.RemitAdminReviewLog.Add(reviewLog);
            _context.Update(record);
            _context.SaveChanges();
        }
Пример #12
0
        public async Task <IActionResult> Edit(int id, [Bind("id,userId")] ShoppingCart shoppingCart)
        {
            if (id != shoppingCart.id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shoppingCart);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShoppingCartExists(shoppingCart.id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["userId"] = new SelectList(_context.User, "id", "id", shoppingCart.userId);
            return(View(shoppingCart));
        }
Пример #13
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,RegionId,Active")] Country country)
        {
            if (id != country.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(country);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CountryExists(country.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RegionId"] = new SelectList(_context.Region, "Id", "Id", country.RegionId);
            return(View(country));
        }
Пример #14
0
        public async Task<Response<OperationResult>> AddUserInfo(string userId, UserInfoDTO model)
        {
            var responce = new Response<OperationResult>()
            {
                Data = OperationResult.Failed
            };
            
            var isExist = await _context.Users.AnyAsync(x => x.Id == userId);

            if (!isExist)
            {
                responce.Error = new Error("User can`t be founded by user id");
                return responce;
            }

            var infoEnity = new UserInfoEntity(model, userId);

            await _context.UsersInfo.AddAsync(infoEnity);
            await _context.SaveChangesAsync();

            var user = await _context.Users.FirstOrDefaultAsync(x => x.Id == userId);

            user.UserInfo = infoEnity;

            _context.Update(user);
            await _context.SaveChangesAsync();

            responce.Data = OperationResult.Success;
            return responce;
        }
        public async Task <IActionResult> Edit(int id, [Bind("FlowerID,FlowerName")] Flower flower)
        {
            if (id != flower.FlowerID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(flower);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FlowerExists(flower.FlowerID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(flower));
        }
Пример #16
0
 public Task Update(Genre genre)
 {
     _context.Update(genre);
     return(_context.SaveChangesAsync());
 }
Пример #17
0
 public Task Update(Game game)
 {
     _context.Update(game);
     return(_context.SaveChangesAsync());
 }
Пример #18
0
 public Task Update(Publisher publisher)
 {
     _context.Update(publisher);
     return(_context.SaveChangesAsync());
 }
Пример #19
0
 public Task Update(Platform platform)
 {
     _context.Update(platform);
     return(_context.SaveChangesAsync());
 }
Пример #20
0
 public Task Update(User user)
 {
     _context.Update(user);
     return(_context.SaveChangesAsync());
 }
Пример #21
0
 public Task Update(ShoppingCart shoppingCart)
 {
     _context.Update(shoppingCart);
     return(_context.SaveChangesAsync());
 }
Пример #22
0
 public Task Update(Review review)
 {
     _context.Update(review);
     return(_context.SaveChangesAsync());
 }
Пример #23
0
 public Task Update(Developer developer)
 {
     _context.Update(developer);
     return(_context.SaveChangesAsync());
 }