public SuitResponseList getAdvices(int id, double latitude, double longitude) { SuitResponseList temp = SuitManager.advise(id, latitude, longitude); //return SuitManager.advise(id, latitude, longitude); return(temp); }
/// <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); }
/// <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)); }
/// <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)); }
/// <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)); }
public BooleanResponse add(IFormFile pic, string name, int wardrobe_id, int[] clothes) { return(new BooleanResponse(SuitManager.add(pic, name, wardrobe_id, clothes))); }
public EvaluationResponse getWarmth(int[] clothes, double temperature) { EvaluationResponse ans = SuitManager.evaluate(clothes, temperature); return(ans); }
public SuitResponseList getByWardrobe(int wardrobe_id, double temperature) { return(SuitManager.getByWardrobe(wardrobe_id, temperature)); }
public ClothesResponseList getClothes(int id) { return(SuitManager.getClothes(id)); }
public BooleanResponse wear(int[] clothes_ids) { return(new BooleanResponse(SuitManager.wear(clothes_ids))); }
public BooleanResponse wear(int id) { return(new BooleanResponse(SuitManager.wear(id))); }
public BooleanResponse delete(int id) { return(new BooleanResponse(SuitManager.delete(id))); }