예제 #1
0
        //[OutputCache(Duration = 900)]
        public async Task <ActionResult> DeletingProduct(string Name, string Description, string Price)
        {
            string id;
            string email;
            string UserId = Session["User"].ToString();
            IEnumerable <Product> items = await DocumentDBRepository <Product> .GetItemsAsync(d => d.Name == Name && d.UserId == UserId && d.Description == Description && d.Price == Convert.ToDouble(Price));

            IEnumerable <Product> item1 = await DocumentDBRepository <Product> .GetItemsAsyncFromCart(d => d.Name == Name && d.Description == Description && d.Price == Convert.ToDouble(Price));

            foreach (Product p in items)
            {
                id = p.id;
                await DocumentDBRepository <Product> .DeleteDocumentFromCollectionAsync(id);
            }

            foreach (Product p in item1)
            {
                id    = p.id;
                email = p.UserId;
                StorageInQueue g = new StorageInQueue();

                await DocumentDBRepository <Product> .DeleteDocumentFromCollectionAsync1(id);

                g.SendingToQueue1(email);
            }

            return(RedirectToAction("Display", "Home"));
        }
예제 #2
0
        public async Task <ActionResult> SignUpMerchant(SignUp model)
        {
            try
            {
                var IdentityUser = await UserManager.FindByNameAsync(model.Username);

                if (IdentityUser != null)
                {
                    return(RedirectToAction("Login", "Profile"));
                }
                var user = new ExtentedSignUp
                {
                    UserName      = model.Username,
                    Fullname      = model.Fullname,
                    Role          = "Merchant",
                    Address       = model.BusinessAddress,
                    ContactNumber = model.ContactNumber,
                    ContactPerson = model.ContactPerson
                };
                Session["User"] = model.Username;


                var IdentityResult = await UserManager.CreateAsync(user, model.Password);

                if (IdentityResult.Succeeded)
                {
                    StorageInQueue g = new StorageInQueue();
                    // g.SendingToQueue(model.ContactPerson, model.BusinessAddress, model.ContactNumber);
                    //await g.SendingToServiceBusQueue(model.ContactPerson, model.BusinessAddress, model.ContactNumber);
                    TempData["user"] = user.UserName;
                    return(RedirectToAction("Login", "Profile"));
                }
                else
                {
                    ModelState.AddModelError("", IdentityResult.Errors.FirstOrDefault());
                }
                return(View("SignUpCustomer"));
            }
            catch (Exception e)
            {
                return(View());
            }
        }