public JsonResult getCloth(int clothId) { Response response = new Response(); ClothDataHandler clothDataHandler = new ClothDataHandler(config); try { Cloth cloth = clothDataHandler.getCloth(clothId); response.data = JsonConvert.SerializeObject(cloth); response.status = true; } catch (Exception ex) { response.status = false; response.message = ex.Message; } return(Json(response)); }
public JsonResult createNewCloth([FromBody] Cloth cloth) { Response response = new Response(); ClothDataHandler clothDataHandler = new ClothDataHandler(config); clothDataHandler.userId = cloth.userId; clothDataHandler.clothType = cloth.clothType; clothDataHandler.clothPicture = cloth.clothPicture; clothDataHandler.color = cloth.color; clothDataHandler.material = cloth.material; clothDataHandler.season = cloth.season; cloth = clothDataHandler.createNewCloth(); response.data = JsonConvert.SerializeObject(cloth); return(Json(response)); }
private JsonResult saveCloth(Cloth cloth, string command) { Response response = new Response(); ClothDataHandler clothDataHandler = new ClothDataHandler(config); clothDataHandler.clothId = cloth.clothId; clothDataHandler.userId = cloth.userId; clothDataHandler.clothType = cloth.clothType; clothDataHandler.clothPicture = cloth.clothPicture; clothDataHandler.color = cloth.color; clothDataHandler.material = cloth.material; clothDataHandler.season = cloth.season; if (command.Equals("create")) { response.status = clothDataHandler.createCloth(); } if (command.Equals("update")) { response.status = clothDataHandler.updateCloth(); } return(Json(response)); }