public Response GetAll(string listType) { try { List list = null; switch (listType) { case "missing": list = new Missing(); break; case "shopping": list = new Shopping(); break; } return(new SuccessResponse <ListModel[]> { results = list.GetAll() }); } catch (Exception e) { throw new Exception(e.Message); } }
public Response Update(string listType, int foodId, [FromBody] ListModel body) { try { List list = null; switch (listType) { case "missing": list = new Missing(); break; case "shopping": list = new Shopping(); break; } list.update(foodId, body); return(new SuccessResponse <ListModel[]> { results = list.GetAll() }); } catch (Exception e) { throw new Exception(e.Message); } }