示例#1
0
        public SuitResponseList getAdvices(int id, double latitude, double longitude)
        {
            SuitResponseList temp = SuitManager.advise(id, latitude, longitude);

            //return SuitManager.advise(id, latitude, longitude);
            return(temp);
        }
示例#2
0
        /// <summary>
        /// 修改衣物属性
        /// </summary>
        /// <param name="clothesPic">衣物新照片</param>
        /// <param name="clothesID">需要编辑的衣物ID</param>
        /// <param name="clothesName">衣物新名称</param>
        /// <param name="type">衣物新类型</param>
        /// <param name="thickness">衣物新厚度</param>
        /// <returns>修改结果 是否修改成功</returns>
        public static bool modify(IFormFile clothesPic, int clothesID, string clothesName, ClothesType type, int thickness)
        {
            Clothes clothes = clothesDb.GetById(clothesID);

            //确认衣物存在
            if (clothes == null)
            {
                return(false);
            }

            //保存衣物照片
            if (clothesPic != null)
            {
                savePic(clothesPic, clothes);
            }

            //修改衣物信息
            clothes.modify(clothesName, type, thickness);

            //执行更新数据库操作并保存更新结果
            bool ans = clothesDb.Update(clothes);

            //更新其相关穿搭的保暖指数
            SuitManager.regenerateWarmthDegreeByClothes(clothesID);

            return(ans);
        }
示例#3
0
        /// <summary>
        /// 删除单件衣物
        /// </summary>
        /// <param name="clothes">需要删除的衣物</param>
        /// <returns>删除结果 是否成功删除</returns>
        public static bool delete(Clothes clothes)
        {
            if (clothes == null)
            {
                return(false);
            }

            deleteClothesPic(clothes);

            return(SuitManager.deleteByClothes(clothes.id) & clothesDb.Delete(clothes));
        }
示例#4
0
        /// <summary>
        /// 根据ID删除单件衣物
        /// </summary>
        /// <param name="clothesID">需要删除的衣物ID</param>
        /// <returns>删除结果 是否成功删除</returns>
        public static bool delete(int clothesID)
        {
            Clothes clothes = clothesDb.GetById(clothesID);

            if (clothes == null)
            {
                return(false);
            }

            deleteClothesPic(clothes);

            return(SuitManager.deleteByClothes(clothesID) & clothesDb.Delete(clothes));
        }
示例#5
0
        /// <summary>
        /// 衣物更换衣橱
        /// </summary>
        /// <param name="clothesID">衣物ID</param>
        /// <param name="targetWardrobeID">需要切换至的衣橱ID</param>
        /// <returns>切换结果 是否成功切换衣橱</returns>
        public static bool changeWardrobe(int clothesID, int targetWardrobeID)
        {
            Clothes clothes = clothesDb.GetById(clothesID);

            //确保衣橱和衣物存在
            if (clothes == null || !WardrobeManager.exist(targetWardrobeID))
            {
                return(false);
            }

            //更换衣橱
            clothes.wardrobeID = targetWardrobeID;

            SuitManager.deleteByClothes(clothesID);

            return(clothesDb.Update(clothes));
        }
示例#6
0
 public BooleanResponse add(IFormFile pic, string name, int wardrobe_id, int[] clothes)
 {
     return(new BooleanResponse(SuitManager.add(pic, name, wardrobe_id, clothes)));
 }
示例#7
0
        public EvaluationResponse getWarmth(int[] clothes, double temperature)
        {
            EvaluationResponse ans = SuitManager.evaluate(clothes, temperature);

            return(ans);
        }
示例#8
0
 public SuitResponseList getByWardrobe(int wardrobe_id, double temperature)
 {
     return(SuitManager.getByWardrobe(wardrobe_id, temperature));
 }
示例#9
0
 public ClothesResponseList getClothes(int id)
 {
     return(SuitManager.getClothes(id));
 }
示例#10
0
 public BooleanResponse wear(int[] clothes_ids)
 {
     return(new BooleanResponse(SuitManager.wear(clothes_ids)));
 }
示例#11
0
 public BooleanResponse wear(int id)
 {
     return(new BooleanResponse(SuitManager.wear(id)));
 }
示例#12
0
 public BooleanResponse delete(int id)
 {
     return(new BooleanResponse(SuitManager.delete(id)));
 }