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, }); }
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 }); }
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 }); }
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 }); }