Пример #1
0
        public void DeleteRequest(int id)
        {
            var request = GetRequestById(id);

            _repo.Delete(request);
            _repo.SaveChanges();
        }
Пример #2
0
        void TestRequestsRepository()
        {
            var newrequest = new Requests()
            {
                Description  = "ZZZ", Justification = "ZZZ", RejectionReason = null,
                DeliveryMode = "Pickup", UserId = UsersRepository.GetByPk(2).Id
            };

            if (!RequestsRepository.Insert(newrequest))
            {
                throw new Exception("Request insert failed!");
            }
            DisplayAllRequests();
            newrequest.Description = "YYY";
            if (!RequestsRepository.Update(newrequest))
            {
                throw new Exception("Request update failed!");
            }
            DisplayAllRequests();
            if (!RequestsRepository.Delete(newrequest))
            {
                throw new Exception("Request delete failed!");
            }
            DisplayAllRequests();
        }
Пример #3
0
 public ActionResult DeleteConfirmed(int id)
 {
     if (db.Delete(id))
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         return(RedirectToAction("Delete/" + id));
     }
 }