コード例 #1
0
 public ActionResult Create(Message message)
 {
     var list = _messageService.MessageTypeService.ListMessagesTypes(null);
     ViewData["List"] = list;
     if (_messageService.CreateMessage(message))
         return RedirectToAction("Index");
     return View(message);
 }
コード例 #2
0
 public bool DeleteMessage(Message message)
 {
     try
     {
         _messagesRepository.DeleteMessage(message);
         return true;
     }
     catch(Exception ex)
     {
         _validationDictionary.AddError("_FORM","Message is not deleted"+ex.Message);
         return false;
     }
 }
コード例 #3
0
        public bool CreateMessage(Message message)
        {
            try
            {
                var ctx = new CurrentContext();
                var client = ctx.CurrentClient;
                var userId = ctx.CurrentUserId;

                var messageType = MessageTypeService.GetMessageType(message.MessageTypeId);
                message.MessageType = messageType;
                //message.MessageTypeId;
                var user = ctx.GetSystemUser();
                message.Client = client;
                message.User = user;
                //message.User.UserId = userId;
                _messagesRepository.CreateMessage(message);
                return true;
            }
            catch (Exception ex)
            {
                _validationDictionary.AddError("_FORM", "Message not created" + ex.Message);
                 return false;
            }
        }
コード例 #4
0
 public ActionResult Delete(Message message)
 {
     if (_messageService.DeleteMessage(message))
         return RedirectToAction("Index");
     return View(message);
 }