public ActionResult SigninOrEdit(SigninUser user)
        {
            bool isSignin = Request.Cookies["user"] == null;

            if (isSignin && DataAccessor.Exists(user.Username, ExistenceCheckOption.ByUsername))
            {
                ModelState.AddModelError("username", "This username is taken. choose an other one.");
            }

            if (isSignin && DataAccessor.Exists(user.Email, ExistenceCheckOption.ByEmail))
            {
                ModelState.AddModelError("email", "This email is already signed in.");
            }

            if (ModelState.IsValid)
            {
                if (isSignin)
                {
                    DataCollector.AddUser(user);
                }
                else
                {
                    DataCollector.UpdateUser(user);
                }

                var u = DataAccessor.GetUser(user.Username, user.Password);

                Response.Cookies["user"]["username"]  = u.Username;
                Response.Cookies["user"]["userId"]    = u.Id.Value.ToString();
                Response.Cookies["user"]["firstName"] = u.FirstName;
                Response.Cookies["user"]["lastname"]  = u.LastNmae;
                Response.Cookies["user"].Expires      = DateTime.Now.AddDays(1);

                var ids = DataAccessor.GetProductsIds(u.Id.Value).Select(p => p.ToString());
                var Ids = new StringBuilder();
                foreach (var item in ids)
                {
                    Ids.Append(item + ",");
                }
                Response.Cookies["cart"]["productsIds"] = Ids.ToString();

                Response.Cookies["cart"].Expires = DateTime.Now.AddDays(-1);

                return(RedirectToRoute(new { Controller = "Home" }));
            }
            ViewBag.IsSignin = isSignin;
            return(View(user));
        }
 static void Main(string[] args)
 {
     try
     {
         BL.DataCollector dc = new DataCollector();
         //dc.ProcessFile();
         DAL.Models.User user = new DAL.Models.User()
         {
             UserName = "******"
         };
         dc.AddUser(user);
     }
     catch (ArgumentException e)
     {
     }
 }