public ActionResult DeletedMessageList() { MessageViewModel model = new MessageViewModel(); string receiverID = messageUnitOfWork.AspNetUserRepository.Get(s => s.UserName == User.Identity.Name).FirstOrDefault().Id; model.messageList = messageUnitOfWork.getAllDeleteMessage(receiverID); model.typeOfMessage = "deletedMessage"; model.numberOfInbox = messageUnitOfWork.getAllMessage(receiverID).Count(); model.numberOfSent = messageUnitOfWork.getAllSentMessage(receiverID).Count(); model.numberOfDeleted = model.messageList.Count(); return View("List", model); }
//public ActionResult SentMessageList(string messageCategory) //{ // MessageViewModel model = new MessageViewModel(); // string receiverID = messageUnitOfWork.AspNetUserRepository.Get(s => s.UserName == User.Identity.Name).FirstOrDefault().Id; // if ("allMessage".Equals(messageCategory)) // { // model.messageList = messageUnitOfWork.getAllMessage(receiverID); // } // if ("sentMessage".Equals(messageCategory)) // { // model.messageList = messageUnitOfWork.getAllSentMessage(receiverID); // return PartialView("_MessageSentPartial", model); // } // if ("deletedMessage".Equals(messageCategory)) // { // model.messageList = messageUnitOfWork.getAllDeleteMessage(receiverID); // } // return PartialView("_MessagePartial", model); //} public ActionResult DeleteMessage(string [] mark, MessageViewModel model) { string userId = messageUnitOfWork.AspNetUserRepository.Get(s => s.UserName == User.Identity.Name).FirstOrDefault().Id; //ArrayList list = new ArrayList(); //List<int> list = listMessageDelete.Split(',').Select(int.Parse).ToList(); //List<string> listString = listMessageDelete.Split(new char[] { ',' }); //list.Add(); List<int> list = new List<int>(); foreach (string item in mark) { int index = Int32.Parse(item); list.Add(index); } messageUnitOfWork.deleteMessage(userId, list, model.typeOfMessage); if (("sentMessage").Equals(model.typeOfMessage)){ return RedirectToAction("SentMessageList"); }else{ return RedirectToAction("List"); } }