public async Task <ActionResult> Cancel(int?id, string bookName) { if (reservService.GetReserv(Convert.ToInt32(id)) != null) { await reservService.Delete(Convert.ToInt32(id), bookName); } return(RedirectToAction("AllReserves", "Libraryan")); }
public async Task <ActionResult> DelReserv(string bookName) { ReservDTO reservDto = reservService.FindReservByBookName(bookName); if (reservDto != null && User.Identity.Name == reservDto.UserName) { await reservService.Delete(reservDto.Id, bookName); } return(RedirectToAction("AllBooks", "Home")); }
private void SendEmail(object obj) { DateTime dd = DateTime.Now; IEnumerable <ReservDTO> reserves = reservService.GetAllReserves(); if (reserves != null) { foreach (ReservDTO reserv in reserves) { if (!reserv.Resolution && reserv.FinishDate <= dd) { reservService.Delete(reserv.Id, reserv.BookName); } } } }