Exemplo n.º 1
0
        public async Task <Result <UntaggedUPC> > UpdateUntaggedUPC(UntaggedUPC upc)
        {
            _dbContext.UntaggedUPC.Update(upc);
            await _dbContext.SaveChangesAsync();

            return(Result.Ok(upc));
        }
Exemplo n.º 2
0
        public async Task <Result> Delete(int untaggedUPCID)
        {
            var untaggedUPC = new UntaggedUPC {
                UntaggedUPCID = untaggedUPCID
            };

            _dbContext.Entry(untaggedUPC).State = EntityState.Deleted;
            var result = await _dbContext.SaveChangesAsync();

            if (result <= 0)
            {
                return(Result.Fail(Constants.No_Rows_Deleted));
            }
            return(Result.Ok());
        }
Exemplo n.º 3
0
 public static Business.Entities.UntaggedUPCBusinessModal CreateMap(UntaggedUPC repoObject)
 {
     return(new UntaggedUPCBusinessModal()
     {
         UPCCode = repoObject.UPCCode,
         UntaggedUPCID = repoObject.UntaggedUPCID,
         Description = repoObject.Description,
         DescriptionID = repoObject.DescriptionID,
         ItemAssignedBy = repoObject.ItemAssignedBy,
         ItemAssignedTo = ObjectMapper.CreateMap(repoObject.ItemAssignedTo),
         ProductType = ObjectMapper.CreateMap(repoObject.ProductType),
         ProductCategory = ObjectMapper.CreateMap(repoObject.ProductCategory),
         ProductSubCategory = ObjectMapper.CreateMap(repoObject.ProductSubCategory),
         ProductSizing = repoObject.ProductSizing,
         StatusID = repoObject.StatusID
     });
 }
Exemplo n.º 4
0
        public static List <UntaggedUPC> DataTableToUntaggedUPCGroup(this DataTable dt)
        {
            List <UntaggedUPC> untaggedUPCGroup = new List <UntaggedUPC>();

            foreach (DataRow dr in dt.Rows)
            {
                var untaggedUPC = new UntaggedUPC()
                {
                    UntaggedUPCID   = Convert.ToInt32(dr["untaggedupcid"]),
                    Description     = dr["description"] == DBNull.Value ? string.Empty : Convert.ToString(dr["description"]),
                    UPCCode         = dr["upccode"] == DBNull.Value ? string.Empty : Convert.ToString(dr["upccode"]),
                    DescriptionID   = dr["descriptionid"] == DBNull.Value ? default(int) : Convert.ToInt32(dr["descriptionid"]),
                    ProductCategory = dr["categoryid"] == DBNull.Value ? null : new ProductCategory
                    {
                        CategoryID   = Convert.ToInt32(dr["categoryid"]),
                        CategoryName = Convert.ToString(dr["category"])
                    },
                    ProductType = dr["typeid"] == DBNull.Value ? null : new ProductType
                    {
                        ProductTypeName = Convert.ToString(dr["producttype"]),
                        TypeID          = Convert.ToInt32(dr["typeid"])
                    },
                    ProductSubCategory = dr["subcategoryid"] == DBNull.Value ? null : new ProductSubCategory
                    {
                        SubcategoryName = Convert.ToString(dr["subcategory"]),
                        SubCategoryID   = Convert.ToInt32(dr["subcategoryid"])
                    },
                    ItemAssignedTo = new User {
                        UserID = dr["itemassingedto"] == DBNull.Value ? default(int) : Convert.ToInt32(dr["itemassingedto"]),
                        Name   = dr["name"] == DBNull.Value ? string.Empty : Convert.ToString(dr["name"]),
                    },
                    ProductSizing = dr["productsizing"] == DBNull.Value ? string.Empty : Convert.ToString(dr["productsizing"])
                };
                untaggedUPCGroup.Add(untaggedUPC);
            }
            return(untaggedUPCGroup);
        }