예제 #1
0
        public async Task <IActionResult> PutRent(Guid id, RentItemViewModel Rent)
        {
            if (id != Rent.Id)
            {
                return(BadRequest());
            }

            try
            {
                _RentItemAppService.Update(Rent);
                return(Ok(Rent));
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            //return NoContent();
        }
예제 #2
0
        public ViewResult List(string category)
        {
            string _category = category;
            IEnumerable <RentItem> rentItems;
            string currCategory = "";

            if (string.IsNullOrEmpty(category))
            {
                rentItems = _RentItems.AllRentItems.OrderBy(i => i.Id);
            }
            else
            {
                if (string.Equals("skyboots", category, StringComparison.OrdinalIgnoreCase))
                {
                    rentItems    = _RentItems.AllRentItems.Where(i => i.Category.Name.Equals("Ботинки Лыжные")).OrderBy(i => i.Id);
                    currCategory = "Ботинки Лыжные";
                }
                else
                {
                    rentItems    = _RentItems.AllRentItems.Where(i => i.Category.Name.Equals("Лыжи")).OrderBy(i => i.Id);
                    currCategory = "Лыжи";
                }
            }

            var rentObj = new RentItemViewModel
            {
                GetAllRentItems = rentItems,
                currentCategory = currCategory
            };

            ViewBag.Title = "На прокат";

            return(View(rentObj));
        }
예제 #3
0
        public void Update(RentItemViewModel RentItemViewModel)
        {
            UpdateRentItemCommand updateRentItemCommand = new UpdateRentItemCommand(_mapper.Map <RentItem>(RentItemViewModel));

            QueueSender.Send(updateRentItemCommand);
        }
예제 #4
0
        public void Create(RentItemViewModel RentItemViewModel)
        {
            CreateRentCommand createRentCommand = new CreateRentCommand(_mapper.Map <Rent>(RentItemViewModel));

            QueueSender.Send(createRentCommand);
        }