public async Task <JsonResult> GetByItemCategory(string api, string category)
 {
     try {
         var data = IS_ItemService.GetByItemCategory(Guid.Parse(api), Guid.Parse(category));
         return(Success(IS_ItemVM.MsToVMs(data)));
     } catch { return(Failed(MessageUtility.ServerError())); }
 }
 public async Task <JsonResult> GetByID(string id, string api)
 {
     try {
         var data = IS_ItemService.GetByID(Guid.Parse(id), Guid.Parse(api));
         return(Success(IS_ItemVM.MToVM(data)));
     } catch { return(Failed(MessageUtility.ServerError())); }
 }
        public static ShopManagementVM SetSubData(ShopManagement model, bool isSetItem)
        {
            var data = ShopManagementVM.MToVM(model);

            data.ProfileImage = ImageLinkStorageVM.MToVM(ImageLinkStorageService.GetByID(model.ProfileImage, model.ID, model.API));
            data.Items        = isSetItem ? IS_ItemService.SetSubDatas(IS_ItemService.GetByOID(model.ID, model.API), model.API) : new List <IS_ItemVM>();
            return(data);
        }
        public static CustomerOrderItemVM SetSubData(CustomerOrderItem model)
        {
            var data = CustomerOrderItemVM.MToVM(model);

            data.DateTime  = DateTimeStorageVM.MToVM(DateTimeStorageService.GetByOID(model.ID, model.API).FirstOrDefault());
            data.Item      = IS_ItemService.SetSubData(IS_ItemService.GetByID(model.ItemID), model.API);
            data.ItemColor = IS_ItemColorService.SetSubData(IS_ItemColorService.GetByID(model.ItemColorID));
            return(data);
        }
 public async Task <JsonResult> IIGetByCategory()
 {
     try {
         var id   = Guid.Parse(Request.Form["id"]);
         var aid  = Guid.Parse(Request.Form["aid"]);
         var data = IS_ItemService.GetByICID(id, aid);
         var vms  = IS_ItemService.SetSubDatas(data, aid);
         return(Success(vms));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> IIGetContains()
 {
     try{
         var input = Request.Form["input"];
         var aid   = Guid.Parse(Request.Form["aid"]);
         var lmt   = int.Parse(Request.Form["lmt"]);
         var data  = IS_ItemService.GetByContains(input, aid, lmt);
         var vms   = IS_ItemService.SetSubDatas(data, aid);
         return(Success(vms));
     }catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> Remove()
 {
     try {
         var id  = Guid.Parse(Request.Form["id"]);
         var api = Guid.Parse(Request.Form["api"]);
         if (IS_ItemService.Remove(id, api))
         {
             return(Success(""));
         }
         return(Failed(MessageUtility.ServerError()));
     } catch { return(Failed(MessageUtility.ServerError())); }
 }
 public async Task <JsonResult> IIRemove()
 {
     try {
         var id  = Guid.Parse(Request.Form["id"]);
         var aid = Guid.Parse(Request.Form["aid"]);
         var oid = Guid.Parse(Request.Form["oid"]);
         if (IS_ItemService.Remove(id, aid, oid))
         {
             return(Success(id.ToString()));
         }
         return(Failed(MessageUtilityService.FailedRemove("Item")));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }
 public async Task <JsonResult> Update()
 {
     try {
         var id          = Guid.Parse(Request.Form["id"]);
         var title       = Request.Form["title"];
         var description = Request.Form["description"];
         var api         = Guid.Parse(Request.Form["api"]);
         if (IS_ItemService.Update(id, title, description, api))
         {
             return(Success(""));
         }
         return(Failed(MessageUtility.ServerError()));
     } catch { return(Failed(MessageUtility.ServerError())); }
 }
 public async Task <JsonResult> Insert()
 {
     try {
         var id           = Guid.NewGuid();
         var title        = Request.Form["title"];
         var description  = Request.Form["description"];
         var api          = Guid.Parse(Request.Form["api"]);
         var itemCategory = Guid.Parse(Request.Form["ic"]);
         var isCount      = Boolean.Parse(Request.Form["isCount"]);
         var storeAPI     = Guid.Parse(Request.Form["spi"]);
         if (IS_ItemService.Insert(id, title, description, api, itemCategory, isCount, 0, storeAPI))
         {
             return(Success(id.ToString()));
         }
         return(Failed(MessageUtility.ServerError()));
     } catch { return(Failed(MessageUtility.ServerError())); }
 }
 public async Task <JsonResult> IIUpdate()
 {
     try {
         var id       = Guid.Parse(Request.Form["id"]);
         var title    = Request.Form["title"];
         var desc     = Request.Form["desc"];
         var price    = float.Parse(Request.Form["price"]);
         var aid      = Guid.Parse(Request.Form["aid"]);
         var oid      = Guid.Parse(Request.Form["oid"]);
         var icid     = Guid.Parse(Request.Form["icid"]);
         var ic       = Boolean.Parse(Request.Form["ic"]);
         var quantity = int.Parse(Request.Form["q"]);
         var dtid     = Guid.Parse(Request.Form["dtid"]);
         if (IS_ItemService.Update(id, oid, aid, icid, title, desc, price, ic, quantity))
         {
             return(Success(id.ToString()));
         }
         return(Failed(MessageUtilityService.FailedUpdate("Item")));
     } catch { return(Failed(MessageUtilityService.ServerError())); }
 }