public async Task <ActionResult> Delete(int id) { RoomReservation reservation = await _roomReservationService.GetRoomReservation(id); if (reservation != null && !await _roomReservationService.CheckIfDateExpired(reservation.ReservationDate, reservation.TimeId)) { RoomReservation roomReservation = await _roomReservationService.GetAllRoomReservations().Include(m => m.Time).Include(m => m.Member).ThenInclude(u => u.UserRoles).FirstOrDefaultAsync(m => m.Id == id); await _roomReservationService.Delete(id); await _roomReservationService.CommitAsync(); if (_configuration.Notify) { try { Message message = new Message( _memberService.GetValidMembersEmails(), "Meeting-Room: " + roomReservation.Member.Name + " " + roomReservation.Member.Surname + " rezervasiyasini sildi.", roomReservation.Description + "\n" + roomReservation.ReservationDate + " " + roomReservation.Time.StartTime + "-" + roomReservation.Time.EndTime); await _emailSender.SendEmailAsync(message); } catch { } } return(Ok()); } return(BadRequest()); }
public async Task <ActionResult <string> > Get() { //CreateRoomReservationDto createRoomReservationDto = new CreateRoomReservationDto() //{ // Description = "First Description", // Title = "First Title", // MeetingRoomId = 1, // TimeId = 2, // MemberId = 2, // ReservationDate = DateTime.Now //}; //_roomReservationService.Create(createRoomReservationDto); RoomReservation reservation = await _roomReservationService.GetRoomReservation(1); return(reservation.Time.ToString()); }