Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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));
        }