public static async Task <dynamic> UpdateChannel(string id, string address, string comment) { CommunicationServiceProxy csvc = new CommunicationServiceProxy(); Communication c = await csvc.LoadEntityByKeyAsync(Cntx, id); if (c == null) { return new { ok = false, msg = ResourceUtils.GetString("2d092e365fe439f4e11223a6aac685df", "Channel not found!") } } ; c.Comment = await csvc.LoadEntityCommentAsync(Cntx, c.ID); c.IsCommentLoaded = true; c.AddressInfo = address; c.Comment = comment; if (c.IsAddressInfoModified || c.IsCommentModified) { var result = await csvc.AddOrUpdateEntitiesAsync(Cntx, new CommunicationSet(), new Communication[] { c }); if ((result.ChangedEntities[0].OpStatus & (int)EntityOpStatus.Updated) > 0) { return new { ok = true, msg = "" } } ; else { return new { ok = false, msg = ResourceUtils.GetString("2cf8b4eaefa665e42735c359a1072a9c", "Update failed!") } }; } else { return new { ok = true, msg = "" } }; }
public static async Task <dynamic> DeleteChannel(string id) { CommunicationServiceProxy csvc = new CommunicationServiceProxy(); Communication c = await csvc.LoadEntityByKeyAsync(Cntx, id); if (c == null) { return new { ok = false, msg = ResourceUtils.GetString("2d092e365fe439f4e11223a6aac685df", "Channel not found!") } } ; await csvc.DeleteEntitiesAsync(Cntx, new CommunicationSet(), new Communication[] { c }); return(new { ok = true, msg = "" }); } }
public static async Task<dynamic> DeleteChannel(string id) { CommunicationServiceProxy csvc = new CommunicationServiceProxy(); Communication c = await csvc.LoadEntityByKeyAsync(Cntx, id); if (c == null) return new { ok = false, msg = ResourceUtils.GetString("2d092e365fe439f4e11223a6aac685df", "Channel not found!") }; await csvc.DeleteEntitiesAsync(Cntx, new CommunicationSet(), new Communication[] { c }); return new { ok = true, msg = "" }; }
public static async Task<dynamic> UpdateChannel(string id, string address, string comment) { CommunicationServiceProxy csvc = new CommunicationServiceProxy(); Communication c = await csvc.LoadEntityByKeyAsync(Cntx, id); if (c == null) return new { ok = false, msg = ResourceUtils.GetString("2d092e365fe439f4e11223a6aac685df", "Channel not found!") }; c.Comment = await csvc.LoadEntityCommentAsync(Cntx, c.ID); c.IsCommentLoaded = true; c.AddressInfo = address; c.Comment = comment; if (c.IsAddressInfoModified || c.IsCommentModified) { var result = await csvc.AddOrUpdateEntitiesAsync(Cntx, new CommunicationSet(), new Communication[] { c }); if ((result.ChangedEntities[0].OpStatus & (int)EntityOpStatus.Updated) > 0) return new { ok = true, msg = "" }; else return new { ok = false, msg = ResourceUtils.GetString("2cf8b4eaefa665e42735c359a1072a9c", "Update failed!") }; } else return new { ok = true, msg = "" }; }