public ActionResult AdPreApproval(int id, BankApprovalView model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    BankApproval newModel = new BankApproval
                    {
                        AuctionRegistrationID = id,
                        DateOfSubmision       = DateTime.Now
                    };
                    newModel.ApprovalPath = FileController.PostFile(model.ApprovalPath, "bankapprovals", "bankapprovals");

                    //Call Post Method
                    APIMethods.APIPost <BankApproval>(newModel, "BankApprovals");

                    int propID = APIMethods.APIGet <AuctionRegistration>(id.ToString(), "AuctionRegistrations").PropertyID;


                    return(RedirectToAction("Detailss", "home", new { id = propID }));
                }
                catch (Exception E)
                {
                    throw new Exception("Something went wrong. Please try again" + E.Message);
                }
            }
            else
            {
                return(View(model));
            }
        }
        public ActionResult AddPhoto(int id, PropertyPhotoView file)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    PropertyPhoto model = new PropertyPhoto();
                    if (file != null)
                    {
                        model.PropertyId        = id;
                        model.Description       = file.Description;
                        model.Title             = file.Title;
                        model.PropertyPhotoPath = FileController.PostFile(file.PropertyPhotoPath, "propertyphotos", "propertyphotos");

                        //Call Post Method
                        APIMethods.APIPost <PropertyPhoto>(model, "PropertyPhotoes");
                        return(View());
                    }
                }
                catch (Exception E)
                {
                    throw new Exception(E.ToString());
                }



                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
        public ActionResult AddBankGuarintee(int id, GuarinteeViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Guarintee newModel = new Guarintee
                    {
                        AuctionRegistrationID = id,
                        DateOfSubmition       = DateTime.Now
                    };
                    newModel.GuarinteePath = FileController.PostFile(model.GuarinteePath, "Guarintees", "guarintees");

                    //Call Post Method
                    APIMethods.APIPost <Guarintee>(newModel, "Guarintees");

                    int propID = APIMethods.APIGet <AuctionRegistration>(id.ToString(), "AuctionRegistrations").PropertyID;

                    return(RedirectToAction("Detailss", "home", new { id = propID }));
                }
                catch (Exception E)
                {
                    throw new Exception("Something went wrong. Please try again" + E.Message);
                }
            }
            else
            {
                return(View(model));
            }
        }
        // GET: Buyers/Create

        public ActionResult CreateAddress(int?id, Address model)
        {
            if (ModelState.IsValid)
            {
                try
                {  //Call Post Method
                    Address objec = APIMethods.APIPost <Address>(model, "Addresses");

                    BuyerAddress bAdd = new BuyerAddress();
                    bAdd.AddressID = objec.AddressID;
                    bAdd.UserID    = User.Identity.GetUserId();
                    APIMethods.APIPost <BuyerAddress>(bAdd, "BuyerAddresses");

                    if (id != 0)
                    {
                        return(RedirectToAction("Detailss", "home", new { id = id }));
                    }
                    return(RedirectToAction("Index"));
                }
                catch (Exception E)
                {
                    throw new Exception("Something went wrong. Please try again");
                }
            }
            else
            {
                return(View());
            }
        }
        public ActionResult AddPromoVideo(int id, PromoVideoData file)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (file != null)
                    {
                        //Call Post Method
                        APIMethods.APIPost <PropertyPhoto>(file, "PropertyPhotoes");
                        return(RedirectToAction("Index"));
                    }
                }
                catch (Exception E)
                {
                    throw new Exception(E.ToString());
                }



                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
        public ActionResult CreateAuctioneer(AuctioneerView model)
        {
            model.UserID = User.Identity.GetUserId();
            if (ModelState.IsValid)
            {
                try
                {
                    var newData = new Auctioneer
                    {
                        UserID               = model.UserID,
                        CompanyName          = model.CompanyName,
                        Branch               = model.Branch,
                        CompanyContactNumber = model.CompanyContactNumber,
                        CompanyEmail         = model.CompanyEmail,
                        Signature            = model.Signature,
                        CompanyDescriprion   = model.CompanyDescriprion,
                    };

                    newData.CompanyLogo = FileController.PostFile(model.CompanyLogo, "CompanyLogo", "CompanyLogo");

                    //Call Post Method
                    Auctioneer ob = APIMethods.APIPost <Auctioneer>(newData, "Auctioneers");

                    return(RedirectToAction("AddAddress"));
                }
                catch (Exception E)
                {
                    throw new Exception(E.ToString());
                }
            }
            else
            {
                return(View());
            }
        }
        public ActionResult AddPropertyStyled(Property model)
        {
            model.SellerID = User.Identity.GetUserId();

            bool   m     = ModelState.IsValid;
            string adddd = model.Address;

            if (ModelState.IsValid)
            {
                Property ob = APIMethods.APIPost <Property>(model, "Properties");

                try
                {
                    //Call Post Method
                    return(RedirectToAction("Index"));
                }
                catch (Exception E)
                {
                    throw new Exception(E.ToString());
                }
            }
            else
            {
                return(View());
            }
        }
        public ActionResult CreatePrivate(PrivateSellerData model)
        {
            model.UserID = User.Identity.GetUserId();
            if (ModelState.IsValid)
            {
                try
                {
                    var newData = new PrivateSeller
                    {
                        UserID    = model.UserID,
                        IDNumber  = model.IDNumber,
                        Signiture = model.Signiture,
                    };

                    newData.ProofOfResedence = FileController.PostFile(model.ProofOfResedence, "ProofOfResedence", "ProofOfResedence");

                    //Call Post Method
                    PrivateSeller ob = APIMethods.APIPost <PrivateSeller>(newData, "PrivateSellers");

                    return(RedirectToAction("AddAddress"));
                }
                catch (Exception E)
                {
                    throw new Exception(E.ToString());
                }
            }
            else
            {
                return(View());
            }
        }
Beispiel #9
0
        public ActionResult AddAddress(Address model)
        {
            if (ModelState.IsValid)
            {
                try
                {  //Call Post Method
                    Address objec = APIMethods.APIPost <Address>(model, "Addresses");

                    SellerAddress sAdd = new SellerAddress
                    {
                        AddressID = objec.AddressID,
                        UserID    = User.Identity.GetUserId()
                    };
                    APIMethods.APIPost <SellerAddress>(sAdd, "SellerAddresses");
                    return(RedirectToAction("Index"));
                }
                catch (Exception E)
                {
                    throw new Exception(E.ToString());
                }
            }
            else
            {
                return(View());
            }
        }
Beispiel #10
0
 public ActionResult Index(Message msg)
 {
     msg.SellerID = "";
     msg.UserID   = "";
     APIMethods.APIPost <Message>(msg, "Messages");
     return(View(msg));
 }
        // POST: SellersAccount/Create

        public ActionResult CreateSeller(SellersView model)
        {
            model.UserID = User.Identity.GetUserId();
            if (ModelState.IsValid)
            {
                try
                {
                    var newData = new Seller
                    {
                        UserID       = model.UserID,
                        FirtstName   = model.FirtstName,
                        Signature    = model.Signature,
                        SellerNumber = model.SellerNumber,
                        SellerEmail  = model.SellerEmail,
                        LastName     = model.LastName,
                        SellerType   = model.SellerType
                    };

                    newData.ProfilePhoto = FileController.PostFile(model.ProfilePhoto, "ProfilePhoto", "ProfilePhoto");



                    //Call Post Method
                    Seller ob = APIMethods.APIPost <Seller>(newData, "Sellers");


                    if (ob.SellerType == "Retailer")
                    {
                        return(RedirectToAction("CreateRetialer"));
                    }
                    else if (ob.SellerType == "Auctioneer")
                    {
                        return(RedirectToAction("CreateAuctioneer"));
                    }
                    else
                    {
                        return(RedirectToAction("CreatePrivate"));
                    }
                }
                catch (Exception E)
                {
                    throw new Exception(E.ToString());
                }
            }
            else
            {
                return(View());
            }
        }
        // GET: Buyers/Create

        public ActionResult Create(int?id, BuyerViewModel model)
        {
            model.UserId = User.Identity.GetUserId();
            if (ModelState.IsValid)
            {
                try
                {
                    RegisteredBuyer newData = new RegisteredBuyer
                    {
                        UserId           = User.Identity.GetUserId(),
                        FirstName        = model.FirstName,
                        LastName         = model.LastName,
                        IDNumber         = model.IDNumber,
                        DateOfBirth      = model.DateOfBirth,
                        Signiture        = model.Signiture,
                        RegistrationDate = DateTime.Now,
                    };

                    newData.ProfilePhotoPath     = FileController.PostFile(model.ProfilePhotoPath, "ProfilePhotos", "ProfilePhotos");
                    newData.ProofOfResidencePath = FileController.PostFile(model.ProofOfResidencePath, "ProofOfResedence", "ProofOfResedence");
                    newData.CopyOfIDPath         = FileController.PostFile(model.CopyOfIDPath, "CopyOfIDPath", "CopyOfIDPath");
                    newData.IDBuyerVerifyPhoto   = FileController.PostFile(model.IDBuyerVerifyPhoto, "IdBuyerVerifyPhoto", "IdBuyerVerifyPhoto");
                    newData.ProofOfBankAccount   = FileController.PostFile(model.ProofOfBankAccount, "ProofOfBankAccount", "ProofOfBankAccount");



                    //Call Post Method
                    RegisteredBuyer ob = APIMethods.APIPost <RegisteredBuyer>(newData, "RegisteredBuyers");
                    return(RedirectToAction("CreateAddress", "Buyers", new { id = id }));
                }
                catch (Exception E)
                {
                    throw new Exception("Something went wrong. Please try again" + E.ToString());
                }
            }
            else
            {
                return(View());
            }
        }
        // GET: Buyers/Create

        public ActionResult RegisterForAuction(int id, AuctionRegistration model)
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Login", "Account"));
            }

            if (model.Signiture)
            {
                try
                {  //Call Post Method
                    model.PropertyID   = id;
                    model.BuyerId      = User.Identity.GetUserId();
                    model.RegesterDate = DateTime.Now;


                    AuctionRegistration objec = APIMethods.APIPost <AuctionRegistration>(model, "AuctionRegistrations");

                    if (model.Bonded)
                    {
                        return(RedirectToAction("AdPreApproval", "Buyers", new { id = objec.id }));
                    }
                    else
                    {
                        return(RedirectToAction("AddBankGuarintee", "Buyers", new { id = objec.id }));
                    }
                }
                catch (Exception e)
                {
                    throw new Exception("Registreation faled." + e.ToString());
                }
            }
            else
            {
                return(View());
            }
        }
        public ActionResult CreateRetialer(RetailerView model)
        {
            model.UserID = User.Identity.GetUserId();
            if (ModelState.IsValid)
            {
                try
                {
                    var newData = new Retailer
                    {
                        UserID               = model.UserID,
                        RetailerName         = model.RetailerName,
                        Signature            = model.Signature,
                        CompanyContactNumber = model.CompanyContactNumber,
                        CompanyEmail         = model.CompanyEmail,
                        CompanyDescription   = model.CompanyDescription,
                        Branch               = model.Branch
                    };

                    newData.CompaynLogoPath = FileController.PostFile(model.CompaynLogoPath, "CompaynLogoPath", "CompaynLogoPath");



                    //Call Post Method
                    Retailer ob = APIMethods.APIPost <Retailer>(newData, "Retailers");
                    return(RedirectToAction("AddAddress"));
                }
                catch (Exception E)
                {
                    throw new Exception(E.ToString());
                }
            }
            else
            {
                return(View());
            }
        }
        public async Task <ActionResult> CreateProperty(PropertyView model)
        {
            if (ModelState.IsValid && model.SellerSigniture)
            {
                try
                {
                    var config = new MapperConfiguration(cfg => {
                        cfg.CreateMap <PropertyView, Property>();
                    });

                    IMapper  mapper  = config.CreateMapper();
                    Property NewProp = mapper.Map <PropertyView, Property>(model);
                    NewProp.SellerID = User.Identity.GetUserId();
                    if (NewProp.TitleDeedPath == "")
                    {
                        NewProp.TitleDeedPath = "N/A";
                    }
                    if (NewProp.BedRooms == null)
                    {
                        NewProp.BedRooms = 0;
                    }
                    if (NewProp.FloorSize == null)
                    {
                        NewProp.FloorSize = 0;
                    }
                    if (NewProp.YardSize == null)
                    {
                        NewProp.YardSize = 0;
                    }
                    if (NewProp.Reserve == null)
                    {
                        NewProp.Reserve = 0;
                    }
                    if (NewProp.Garages == null)
                    {
                        NewProp.Garages = 0;
                    }
                    if (NewProp.OpeningBid == null)
                    {
                        NewProp.OpeningBid = 0;
                    }
                    if (NewProp.TaxesAndRate == null)
                    {
                        NewProp.TaxesAndRate = 0;
                    }
                    if (NewProp.levies == null)
                    {
                        NewProp.levies = 0;
                    }

                    NewProp.MandateSingedDate = DateTime.Now;
                    NewProp.MandateExpireDate = DateTime.Now.AddDays(90);
                    NewProp.TaxesAndRates     = FileController.PostFile(model.TaxesAndRates, "TaxesAndRates", "TaxesAndRates");
                    NewProp.PlansPath         = FileController.PostFile(model.PlansPath, "Plans", "Plans");
                    //  NewProp.TitleDeedPath = FileController.PostFile(model.TitleDeedPath, "Titledeeds", "Titledeeds");
                    NewProp.HOARules = FileController.PostFile(model.HOARules, "HOARules", "HOARules");

                    //Call Post Method
                    Property ob = APIMethods.APIPost <Property>(NewProp, "Properties");

                    SendGridService ser = new SendGridService();

                    /*EmailMessageInfo msg = new EmailMessageInfo() {
                     *  FromEmailAddress = "*****@*****.**",
                     *  ToEmailAddress = model.Seller.SellerEmail,
                     *  EmailSubject ="New Property listing.",
                     *  EmailBody = "Property: Title-"+model.Title+"/n Address- "+model.Address+"/n Youre listing will be reviewed and you will be notified Accordingly."
                     * };
                     * //          await ser.Send(msg);
                     *
                     * EmailMessageInfo msgAdmin = new EmailMessageInfo() {
                     *  FromEmailAddress = "*****@*****.**",
                     *  ToEmailAddress = model.Seller.SellerEmail,
                     *  EmailSubject ="New Property listing.",
                     *  EmailBody = "Property: Title-"+model.Title+"/n Address- "+model.Address+"./n Property listed by "+model.Seller.FirtstName+" "+model.Seller.LastName
                     * };
                     * await ser.Send(msgAdmin);*/

                    return(RedirectToAction("AddPhoto", new { id = ob.PropertyID }));
                }
                catch (Exception E)
                {
                    throw new Exception(E.Message);
                }
            }
            else
            {
                return(View(model));
            }
        }