public async Task <IActionResult> CreateRent([FromBody] RentAggregate rentDto) { var copter = _copterRepository.Get(rentDto.CopterId).Result; if (copter.Status != Status.Ordered) { var rent = Rent.CreateFromDto(rentDto); rent = await _rentRepository.Create(rent); await _hub.StartUsingCopter(rent); //_copterRepository.UpdateStatus(rentDto.CopterId); return(Ok("Success")); } return(BadRequest()); }
public IActionResult Save([FromBody] Rent rent) { if (rent is null) { return(BadRequest("Rent is null.")); } if (!ModelState.IsValid) { return(BadRequest()); } if (rent.RentId == 0) { _repository.Create(rent); return(new JsonResult(new { create = true, rent })); } else { _repository.Update(rent); return(new JsonResult(new { update = true, rent })); } }
public void Create(Rent Rent) { _RentRepository.Create(Rent); }
public void Create(Rent Rent) { Rent.Id = new Guid(); _RentRepository.Create(Rent); }