public Response Delete(int agencyid, int agentid) { Response response = new Response(); AgencyAgent toDelete = context.AgencyAgent.Find(agencyid, agentid); if (toDelete == null) { response.Message += $"AgencyAgent with ID {agencyid}, {agentid} not found"; response.Success = false; return(response); } context.AgencyAgent.Remove(toDelete); response.Success = context.SaveChanges() == 1; return(response); }
public Response Delete(int missionId) { Response response = new Response(); Mission toDelete = context.Mission.Find(missionId); if (toDelete == null) { response.Message = $"Mission with ID {missionId} not found"; response.Success = false; return(response); } context.Mission.Remove(toDelete); response.Success = context.SaveChanges() == 1; return(response); }
public Response Delete(int aliasId) { Response response = new Response(); try { Alias alias = context.Alias.Find(aliasId); context.Alias.Remove(alias); response.Success = context.SaveChanges() == 1; return(response); } catch { response.Success = false; response.Message = $"Could not delete Alias with ID {aliasId}"; return(response); } }
public Response Delete(int locationId) { Response response = new Response(); Location toDelete = context.Location.Find(locationId); try { context.Location.Remove(toDelete); response.Success = context.SaveChanges() == 1; } catch { response.Success = false; response.Message = $"Location with ID {locationId} not found"; return(response); } if (!response.Success) { response.Message = $"Location with ID {locationId} not found"; } return(response); }