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)); }