Example #1
0
        public RedirectToActionResult Register(Worker worker)
        {
            var employee = ContextHelper.GetWorkers(_db)
                           .FirstOrDefault(w => w.Username.Equals(worker.Username) ||
                                           w.EmailAddress.Equals(worker.EmailAddress));

            if (employee == null)
            {
                if (worker.Picture != null)
                {
                    worker.SavePicture(_host, worker.Picture);
                }


                ContextHelper.AddWorker(_db, worker);

                return(RedirectToAction("Index", "Home"));
            }

            return(RedirectToAction("Index"));
        }