public async Task <IActionResult> Create([Bind("Id,Image")] OffersGalleryViewModel offersGalleryViewModel)
        {
            if (ModelState.IsValid)
            {
                string filename = "";
                if (offersGalleryViewModel.Image != null && offersGalleryViewModel.Image.Length > 0)
                {
                    filename = Guid.NewGuid().ToString().Substring(4) + offersGalleryViewModel.Image.FileName;
                    UploadFile(offersGalleryViewModel.Image, filename);
                }
                string userId = "";
                if (!string.IsNullOrEmpty(Request.Form["User"]))
                {
                    userId = Request.Form["User"];
                }
                else
                {
                    userId = _userManager.GetUserId(User);
                }
                var        user       = _context.Users.Find(userId);
                HomeSlider homeSlider = new HomeSlider {
                    Media = filename, MediaType = offersGalleryViewModel.MediaType
                };
                _context.Add(homeSlider);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(offersGalleryViewModel));
        }
        public async Task <IActionResult> Create([Bind("Id,Quantity,TotalPrice")] BasketItems basketItems)
        {
            if (ModelState.IsValid)
            {
                _context.Add(basketItems);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(basketItems));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("Id,ProfileId,AccessKey,SecuritySign,PaymentType,RecurringFrequency")] PaymentSetting paymentSetting)
        {
            if (ModelState.IsValid)
            {
                _context.Add(paymentSetting);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(paymentSetting));
        }
        public async Task <IActionResult> Create([Bind("Id")] OffersCategory offersCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(offersCategory);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(offersCategory));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("Id")] BlogCategoryRelation blogCategoryRelation)
        {
            if (ModelState.IsValid)
            {
                _context.Add(blogCategoryRelation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(blogCategoryRelation));
        }
        public async Task <IActionResult> Create([Bind("Id,FullName,GuestStatus,Side,Email,Phone,Address")] GuestList guestList)
        {
            if (ModelState.IsValid)
            {
                _context.Add(guestList);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(guestList));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("Id,Status,ReferenceNumber,TransactionUUID,TransactionDate,Total")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(order));
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> Create([Bind("Id,Title,HtmlDescription")] Pages pages)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pages);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pages));
        }
        public async Task <IActionResult> Create([Bind("Id,comment,author,email,subject,rating,DateIn,Status")] VendorItemReview vendorItemReview)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vendorItemReview);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vendorItemReview));
        }
        public async Task <IActionResult> Create([Bind("Id,TipsTitle,FeaturedVendorsTitle,BlogTitle,ContactAddress,ContactEmail,ContactPhone,AdminEmail,AdminEmailPassword")] WebContent webContent)
        {
            if (ModelState.IsValid)
            {
                _context.Add(webContent);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(webContent));
        }
        public async Task <IActionResult> Create([Bind("Id")] WishList wishList)
        {
            if (ModelState.IsValid)
            {
                _context.Add(wishList);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(wishList));
        }
Ejemplo n.º 12
0
        public async Task <IActionResult> Create([Bind("Id,Description,EstimatedCost,ActualCost,PaidCost,Notes")] Budget budget)
        {
            if (ModelState.IsValid)
            {
                _context.Add(budget);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(budget));
        }
Ejemplo n.º 13
0
        public async Task <IActionResult> Create([Bind("Id,VendorItemId")] VendorItemTypeValue vendorItemTypeValue)
        {
            if (ModelState.IsValid)
            {
                _context.Add(vendorItemTypeValue);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["VendorItemId"] = new SelectList(_context.VendorItems, "Id", "Id", vendorItemTypeValue.VendorItemId);
            return(View(vendorItemTypeValue));
        }
        public async Task <IActionResult> Create([Bind("Id,Title,Latitude,Longitude,Location,PhoneNumber,HtmlDescription,Address,Email,IsFeatured,Thumb,Categories,Website,Facebook,Instagram")] VendorItemViewModel vendorItemViewModel)
        {
            if (ModelState.IsValid)
            {
                string filename = "";
                if (vendorItemViewModel.Thumb != null && vendorItemViewModel.Thumb.Length > 0)
                {
                    filename = Guid.NewGuid().ToString().Substring(4) + vendorItemViewModel.Thumb.FileName;
                    UploadFile(vendorItemViewModel.Thumb, filename);
                }
                string userId = "";
                if (!string.IsNullOrEmpty(Request.Form["User"]))
                {
                    userId = Request.Form["User"];
                }
                else
                {
                    userId = _userManager.GetUserId(User);
                }
                var        user = _context.Users.Find(userId);
                VendorItem row  = new VendorItem {
                    Thumb = filename, MediaType = vendorItemViewModel.MediaType, Address = vendorItemViewModel.Address, Country = vendorItemViewModel.Country, Email = vendorItemViewModel.Email, HtmlDescription = vendorItemViewModel.HtmlDescription, IsFeatured = vendorItemViewModel.IsFeatured, Latitude = vendorItemViewModel.Latitude, Longitude = vendorItemViewModel.Longitude, Location = vendorItemViewModel.Location, PhoneNumber = vendorItemViewModel.PhoneNumber, Title = vendorItemViewModel.Title, UserId = user.Id, Website = vendorItemViewModel.Website, Facebook = vendorItemViewModel.Facebook, Instagram = vendorItemViewModel.Instagram
                };
                string[] catIds = Request.Form["Categories"].ToString().Split(',');

                var dbcats = _context.VendorCategories.Where(x => catIds.Contains(x.Id.ToString())).ToList();
                foreach (var dbcat in dbcats)
                {
                    _context.VendorItemCategories.Add(new VendorItemCategory {
                        VendorCategory = dbcat, VendorItem = row
                    });
                }
                var taxonomies = _context.VendorTypes.Include(x => x.VendorTypeValues);
                foreach (var tax in taxonomies)
                {
                    string[] valueIds = Request.Form[tax.Id.ToString()].ToString().Split(',');

                    var dbvalues = _context.VendorTypeValues.Where(x => valueIds.Contains(x.Id.ToString())).ToList();
                    foreach (var dbcat in dbvalues)
                    {
                        _context.VendorItemTypeValues.Add(new VendorItemTypeValue {
                            VendorTypeValue = dbcat, VendorItem = row
                        });
                    }
                }
                _context.Add(row);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(vendorItemViewModel));
        }
Ejemplo n.º 15
0
        public async Task <Order> PostOrder([FromBody] Order order)
        {
            if (!ModelState.IsValid)
            {
                return(null);
            }
            order.TransactionDate = DateTime.Now;
            order.ReferenceNumber = Get8Digits();
            string requestId = Guid.NewGuid().ToString().Replace("-", "");

            order.TransactionUUID = requestId;
            _context.Add(order);
            await _context.SaveChangesAsync();

            if (order.OrderStatus == OrderStatus.Completed)
            {
                StreamReader sr          = new StreamReader(_hostingEnvironment.WebRootPath + "/emailtemplate/OrderConfirmed.html");
                string       temp        = sr.ReadToEnd();
                var          basketitems = _context.BasketItems.Where(x => x.Order.Id == order.Id).Include(x => x.Offers).Include(x => x.Offers.User).ToList();
                string       ordertable  = "";
                foreach (var item in basketitems)
                {
                    ordertable += @"<tr class=""m_-5965336264313205829order_item"">
                                                                                                        <td class=""m_-5965336264313205829td"" style=""color:#636363;border:1px solid #e5e5e5;vertical-align:middle;padding:12px;text-align:left;font-family:'Helvetica Neue',Helvetica,Roboto,Arial,sans-serif;word-wrap:break-word"">
                                                                                                            " + item.Offers.Title + @"<ul class=""m_-5965336264313205829wc-item-meta"" style=""font-size:small;margin:1em 0 0;padding:0;list-style:none"">
                                                                                                                <li style=""margin:0.5em 0 0;padding:0"">
                                                                                                                    <strong class=""m_-5965336264313205829wc-item-meta-label"" style=""float:left;margin-right:.25em;clear:both"">Sold By:</strong>" + (item.Offers.User != null ? item.Offers.User.UserName : "******") + @"</p>
                                                                                                                </li>
                                                                                                            </ul>
                                                                                                        </td>
                                                                                                        <td class=""m_-5965336264313205829td"" style=""color:#636363;border:1px solid #e5e5e5;vertical-align:middle;padding:12px;text-align:left;font-family:'Helvetica Neue',Helvetica,Roboto,Arial,sans-serif"">
                                                                                                            " + item.Quantity + @"
                                                                                                        </td>
                                                                                                        <td class=""m_-5965336264313205829td"" style=""color:#636363;border:1px solid #e5e5e5;vertical-align:middle;padding:12px;text-align:left;font-family:'Helvetica Neue',Helvetica,Roboto,Arial,sans-serif"">
                                                                                                            <span class=""m_-5965336264313205829woocommerce-Price-amount m_-5965336264313205829amount""><span class=""m_-5965336264313205829woocommerce-Price-currencySymbol"">$</span>" + item.TotalPrice + @"</span>
                                                                                                        </td>
                                                                                                    </tr>";
                }

                var user = _context.Users.Where(x => x.Id == order.UsersId).FirstOrDefault();
                temp = temp.Replace("$username$", (user != null ? user.UserName : "******")).Replace("$referencenumber$", order.ReferenceNumber).Replace("$date$", order.TransactionDate.ToString()).Replace("$order$", ordertable).Replace("$subtotal$", order.Total.ToString()).Replace("$total$", order.Total.ToString());
                sr.Close();
                await _emailSender.SendEmailAsync(
                    order.Users.Email,
                    "Order confirmed from planmy",
                    temp);
            }
            return(order);
        }
Ejemplo n.º 16
0
        public async Task <IActionResult> Create([Bind("Id,Title,VendorCategoryId")] VendorType vendorType)
        {
            if (ModelState.IsValid)
            {
                var catId = int.Parse(Request.Form["VendorCategoryId"]);
                var cat   = _context.VendorCategories.Find(catId);
                vendorType.VendorCategory = cat;
                _context.Add(vendorType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewBag.Categories = new SelectList(_context.VendorCategories, "Id", "Title");
            return(View(vendorType));
        }
        public async Task <IActionResult> Create([Bind("Id,Media,MediaType")] HomeSliderViewModel homeSliderViewModel)
        {
            if (ModelState.IsValid)
            {
                string filename = Guid.NewGuid().ToString().Substring(4) + homeSliderViewModel.Media.FileName;
                UploadFile(homeSliderViewModel.Media, filename);
                HomeSlider homeSlider = new HomeSlider {
                    Media = filename, MediaType = homeSliderViewModel.MediaType
                };
                _context.Add(homeSlider);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(homeSliderViewModel));
        }
Ejemplo n.º 18
0
        public async Task <IActionResult> Create([Bind("Id,Image,Title,Description")] homeTipsViewModel homeTipsViewModel)
        {
            if (ModelState.IsValid)
            {
                string filename = Guid.NewGuid().ToString().Substring(4) + homeTipsViewModel.Image.FileName;
                UploadFile(homeTipsViewModel.Image, filename);
                HomeTips homeTips = new HomeTips {
                    Media = filename, MediaType = homeTipsViewModel.MediaType, Description = homeTipsViewModel.Description, Title = homeTipsViewModel.Title, Image = filename
                };
                _context.Add(homeTips);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(homeTipsViewModel));
        }
        public async Task <IActionResult> Create([Bind("Id,Title,Address,PhoneNumber,Latitude,Longitude,VendorItem")] VendorBranches vendorBranches, int itemId)
        {
            if (ModelState.IsValid)
            {
                vendorBranches.VendorItemId = itemId;
                _context.Add(vendorBranches);
                await _context.SaveChangesAsync();

                var parms = new Dictionary <string, string>
                {
                    { "itemId", itemId.ToString() }
                };
                return(RedirectToAction(nameof(Index), parms));
            }

            return(View(vendorBranches));
        }
Ejemplo n.º 20
0
        public async Task <IActionResult> Create([Bind("Id,Title")] VendorTypeValue vendorTypeValue, int typeId)
        {
            if (ModelState.IsValid)
            {
                var vendortype = _context.VendorTypes.Find(typeId);
                vendorTypeValue.VendorType = vendortype;
                _context.Add(vendorTypeValue);
                await _context.SaveChangesAsync();

                var parms = new Dictionary <string, string>
                {
                    { "typeId", typeId.ToString() }
                };
                return(RedirectToAction(nameof(Index), parms));
            }
            return(View(vendorTypeValue));
        }
Ejemplo n.º 21
0
        public async Task <IActionResult> Create([Bind("Id,Title,Link,Image")] SocialMediaViewModel socialMediaViewModel)
        {
            if (ModelState.IsValid)
            {
                string filename = "";
                if (socialMediaViewModel.Image != null)
                {
                    filename = Guid.NewGuid().ToString().Substring(4) + socialMediaViewModel.Image.FileName;
                    UploadFile(socialMediaViewModel.Image, filename);
                }
                SocialMedia socialmedia = new SocialMedia {
                    Image = filename, MediaType = socialMediaViewModel.MediaType, Link = socialMediaViewModel.Link, Title = socialMediaViewModel.Title
                };
                _context.Add(socialmedia);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(socialMediaViewModel));
        }
Ejemplo n.º 22
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Age,Gender,Address,City,Country,UserType,CreationDate,Image,PhoneNumber,Email,Username")] UsersViewModel users)
        {
            if (ModelState.IsValid)
            {
                string filename = "";
                if (users.Image != null)
                {
                    filename = Guid.NewGuid().ToString().Substring(4) + users.Image.FileName;
                    UploadFile(users.Image, filename);
                }
                Users user = new Users {
                    Id = users.Id, FirstName = users.FirstName, LastName = users.LastName, Age = users.Age, Gender = users.Gender, Address = users.Address, City = users.City, Country = users.Country, UserType = users.UserType, CreationDate = users.CreationDate, Image = filename, UserName = users.Username, PhoneNumber = users.PhoneNumber, Email = users.Email
                };
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
        public async Task <IActionResult> Create([Bind("Id,Image,Title")] BlogCategoryViewModel blogCategoryViewModel)
        {
            if (ModelState.IsValid)
            {
                string filename = "";
                if (blogCategoryViewModel.Image != null)
                {
                    filename = Guid.NewGuid().ToString().Substring(4) + blogCategoryViewModel.Image.FileName;
                    UploadFile(blogCategoryViewModel.Image, filename);
                }
                BlogCategory category = new BlogCategory {
                    Image = filename, Title = blogCategoryViewModel.Title
                };
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(blogCategoryViewModel));
        }
Ejemplo n.º 24
0
        public async Task <IActionResult> Create([Bind("Id,Image")] VendorItemGalleryViewModel vendorItemGalleryViewModel, int itemId)
        {
            if (ModelState.IsValid)
            {
                foreach (var img in vendorItemGalleryViewModel.Image)
                {
                    string filename = "";
                    if (img != null)
                    {
                        filename = Guid.NewGuid().ToString().Substring(4) + img.FileName;
                        UploadFile(img, filename);
                    }

                    string userId = "";
                    if (!string.IsNullOrEmpty(Request.Form["User"]))
                    {
                        userId = Request.Form["User"];
                    }
                    else
                    {
                        userId = _userManager.GetUserId(User);
                    }
                    var user = _context.Users.Find(userId);
                    var item = _context.VendorItems.Find(itemId);
                    VendorItemGallery vendorItemGallery = new VendorItemGallery {
                        Image = filename, MediaType = vendorItemGalleryViewModel.MediaType, Item = item
                    };
                    _context.Add(vendorItemGallery);
                    await _context.SaveChangesAsync();
                }
                var parms = new Dictionary <string, string>
                {
                    { "itemId", itemId.ToString() }
                };
                return(RedirectToAction(nameof(Index), parms));
            }

            return(View(vendorItemGalleryViewModel));
        }
        public async Task <IActionResult> Create([Bind("Id,Image")] BlogGalleryViewModel blogGalleryviewmodel, int blogId)
        {
            if (ModelState.IsValid)
            {
                string filename = "";
                if (blogGalleryviewmodel.Image != null && blogGalleryviewmodel.Image.Length > 0)
                {
                    filename = Guid.NewGuid().ToString().Substring(4) + blogGalleryviewmodel.Image.FileName;
                    UploadFile(blogGalleryviewmodel.Image, filename);
                }
                string userId = "";
                if (!string.IsNullOrEmpty(Request.Form["User"]))
                {
                    userId = Request.Form["User"];
                }
                else
                {
                    userId = _userManager.GetUserId(User);
                }
                var         user        = _context.Users.Find(userId);
                var         blog        = _context.Blogs.Find(blogId);
                BlogGallery blogGallery = new BlogGallery {
                    Image = filename, Blog = blog
                };
                _context.Add(blogGallery);
                await _context.SaveChangesAsync();

                var parms = new Dictionary <string, string>
                {
                    { "blogId", blogId.ToString() }
                };
                return(RedirectToAction(nameof(Index), parms));
            }

            return(View(blogGalleryviewmodel));
        }