Exemple #1
0
        public ActionReturn Insert(Models.CallChatSetting setting)
        {
            filter.Add("CFromId", new FilterCondition()
            {
                Condition = Condition.Or,
                Operation = CommonLibrary.Operation.EqualTo,
                Value     = setting.FromId.ToString()
            });
            filter.Add("CToId", new FilterCondition()
            {
                Condition = Condition.Or,
                Operation = CommonLibrary.Operation.EqualTo,
                Value     = setting.ToId.ToString()
            });
            bool status = false;

            DB.CallChatSetting chatSestting = _dbCommands.FetchRecords <DB.CallChatSetting>(new Filter()
            {
                FilterOn = filter
            }).SingleOrDefault();
            if (chatSestting == null)
            {
                chatSestting = Assgin(setting);
                _dbCommands.Insert(chatSestting);
                status = _dbCommands.Save();
            }
            return(new ActionReturn()
            {
                Id = chatSestting.CId,
                Status = status,
            });
        }
Exemple #2
0
        public ActionReturn Delete(Models.CallChatSetting setting)
        {
            bool status = false;

            DB.CallChatSetting chatSestting = _dbCommands.FetchSingleRecord <DB.CallChatSetting>(setting.Id);
            if (chatSestting != null)
            {
                _dbCommands.ActionState(chatSestting, System.Data.Entity.EntityState.Deleted);
                status = _dbCommands.Save();
            }
            return(new ActionReturn()
            {
                Id = setting.Id,
                Status = status
            });
        }
Exemple #3
0
 protected Models.CallChatSetting Assgin(DB.CallChatSetting setting)
 {
     if (setting == null)
     {
         return(null);
     }
     return(new Models.CallChatSetting()
     {
         Id = setting.CId,
         ToId = setting.CToId,
         FromId = setting.CFromId,
         CallBlocked = setting.CCallBlocked,
         ChatBlocked = setting.CChatBlocked,
         IsActive = setting.isActive,
         Status = setting.Status
     });
 }
Exemple #4
0
        public ActionReturn UpdateSetting(Models.CallChatSetting setting)
        {
            bool status = false;

            DB.CallChatSetting chatSestting = _dbCommands.FetchSingleRecord <DB.CallChatSetting>(setting.Id);
            if (chatSestting != null)
            {
                if (chatSestting.CCallBlocked != setting.CallBlocked)
                {
                    chatSestting.CCallBlocked = setting.CallBlocked;
                }
                if (chatSestting.CChatBlocked != setting.ChatBlocked)
                {
                    chatSestting.CChatBlocked = setting.CallBlocked;
                }
                status = _dbCommands.Save();
            }
            return(new ActionReturn()
            {
                Id = setting.Id,
                Status = status
            });
        }