예제 #1
0
 /// <summary>
 /// For saving the Messages
 /// </summary>
 /// <param name="model"></param>
 public AgentMessageBoardModel Create(AgentMessageBoardModel model, int[] ChkAgentId, int[] ChkProductId, out ActionResponse _ores)
 {
     _res = Validate(model, ChkAgentId, ChkProductId);
     if (_res.ErrNumber == 0)
     {
         AgentMessageBoards obj = new AgentMessageBoards
         {
             MessageTypeId     = model.MessageTypeId,
             MessagePriorityId = model.PriorityId,
             isforAllAgent     = model.IsForAllAgent,
             HeadingContent    = model.HeadContains,
             MessageContent    = model.MessageContains,
             EffectiveFrom     = (DateTime)model.EffectiveFrom,
             ExpireOn          = (DateTime)model.ExpiredOn,
             AgentIdList       = model.AgentIdList.TrimEnd(','),
             //ProductIdList = "1",
             ProductIdList     = model.ProductIdList.TrimEnd(','),
             isActive          = true,
             CreatedBy         = model.CreatedBy,
             CreatedDate       = DateTime.Now,
             MessageCategoryId = model.MessageCatagoriesId,
         };
         _ent.AddToAgentMessageBoards(obj);
         _ent.SaveChanges();
         _res.ActionMessage  = String.Format(Resources.Message.SuccessfullySaved, "Message");
         _res.ErrNumber      = 0;
         _res.ErrSource      = "DataBase";
         _res.ErrType        = "App";
         _res.ResponseStatus = true;
     }
     _ores = _res;
     return(model);
 }