public IActionResult Get([FromBody] Handyman handyman) { Dictionary <string, object> res; try { res = Service.createSuccessRes(); if (handyman.Id != 0) { res.Add("Handyman", HandymanData.GetHandyman(handyman)); res.Add("Businesses", HandymanData.GetHandymanBusinesses(handyman.Id)); res.Add("Categories", HandymanData.GetHandymanCategories(handyman.Id)); res.Add("Areas", HandymanData.GetHandymanAreas(handyman.Id)); } else { res.Add("Handymen", HandymanData.GetAll()); } return(Ok(res)); } catch (System.Exception ex) { res = Service.createErrorRes(ex.Message); return(BadRequest(res)); } }
public IActionResult Delete([FromBody] Handyman handyman) { Dictionary <string, object> res; try { res = HandymanData.Delete(handyman); return(Ok(res)); } catch (System.Exception ex) { res = Service.createErrorRes(ex.Message); return(BadRequest(res)); } }