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(); }
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)); }
public void Update(RentItemViewModel RentItemViewModel) { UpdateRentItemCommand updateRentItemCommand = new UpdateRentItemCommand(_mapper.Map <RentItem>(RentItemViewModel)); QueueSender.Send(updateRentItemCommand); }
public void Create(RentItemViewModel RentItemViewModel) { CreateRentCommand createRentCommand = new CreateRentCommand(_mapper.Map <Rent>(RentItemViewModel)); QueueSender.Send(createRentCommand); }