public ActionResult SaveProfile(int? id, string nameOfBusiness, string address, string city, string state,
            string zip, string password, string phone, string industry, string relatedServices,
            string paymentInfo, string salesPitch, HttpPostedFileBase photo,
            string refundPolicy, string customerAnalytics)
        {
            var dao = new MerchantDao();
               var m = GetMerchant(id, dao);
               if (m == null)
               {
              // No profile was found
              return RedirectToAction("Index", "Home");
               }
               m.NameOfBusiness = nameOfBusiness;
               m.Address = address;
               m.City = city;
               m.State = state;
               m.Zip = zip;
               m.Password = password;
               m.Phone = phone;
               m.Industry = null; // industry;
               m.IndustryRelated = null; // relatedServices;
               m.PaymentInfo = paymentInfo;
               dao.Update(m);

            //           if (!HttpContext.User.Identity.IsAuthenticated)
            //              SigninController.SetAuthCookie(m.Id);

               return RedirectToAction("Index", "MyDeals");
        }
 public ActionResult Index(int? id)
 {
     var dao = new MerchantDao();
        var m = GetMerchant(id, dao);
        if (m == null)
        {
       // No profile was found
       return RedirectToAction("Index", "Home");
        }
        return View(m);
 }
 public ActionResult Index(string Email, string Password)
 {
     var m = new MerchantDao().Authenticate(Email, Password);
      if (m != null)
      {
     FormsAuthentication.SetAuthCookie(m.Id.ToString(), false);
     return RedirectToAction("Index", "MyDeals");
      }
      else
      {
     return RedirectToAction("SignInFailed");
      }
 }
 static dal.linq.Merchant GetMerchant(int? id, MerchantDao dao)
 {
     if (id == null)
       {
      // Id is required
      return null;
       }
       var identity = System.Web.HttpContext.Current.User.Identity;
       if (identity.IsAuthenticated && id.ToString() != identity.Name)
       {
      // Unable to see other profile
      return null;
       }
       var m = dao.Get(id.Value);
       return m;
 }
 public ActionResult Index(int? id)
 {
     var dao = new MerchantDao();
      if (id != null)
      {
     var m = dao.Get(id.Value);
     if (m != null)
     {
        if (!m.Confirmed)
        {
           // Confirmation
           m.Confirmed = true;
           dao.Update(m);
           ViewBag.isConfirmation = true;
        }
        ViewBag.email = m.Email;
     }
      }
      return View();
 }
        public ActionResult Index(string name, string email, string nameOfBusiness, string address, string city, string state,
            string zip, string phone, string industry, string relatedServices, string password, string paymentInfo)
        {
            try
               {
              var dao = new MerchantDao();
              var m = dao.Create(email, password);

              m.Name = name;
              m.NameOfBusiness = nameOfBusiness;
              m.Address = address;
              m.City = city;
              m.State = state;
              m.Zip = zip;
              m.Phone = phone;
              m.Industry = null; // industry;
              m.IndustryRelated = null; // relatedServices;
              m.PaymentInfo = paymentInfo;
              dao.Update(m);

              // Send the confirmation email here
              var emailFields = new
              {
                 ConfirmUrl = Url.Action("Index", "signin", new { id = m.Id }, "http")
              };
              var emailBody = Email.BodyFromTemplateFile(Server.MapPath("~/Emails/signup_confirmation.htm"), emailFields);

              if (utils.Email.Send("Merchant Beat SingUp confirmation", emailBody, new string[] { m.Email }, new string[] { }))
              {
                 return RedirectToAction("signedup", new { id = m.Id });
              }
              else
              {
                 throw new Exception("SignUp Confirmation email sending failed");
              }
               }
               catch (Exception)
               {
              return RedirectToAction("Index", "Home");
               }
        }