Exemple #1
0
        public async Task <ActionResult> registration(RegisterViewModel regModel)
        {
            if (!ModelState.IsValid)
            {
                if (regModel.UserName != null && _userService.UserNameExists(regModel.UserName))
                {
                    ModelState.AddModelError("UserName", "user with such a UserName exists");
                }
                return(View(regModel));
            }

            IdentityResult regResult = _userService.Create(regModel.UserName, regModel.Email, regModel.Password, "user");

            if (regResult.Succeeded)
            {
                var    user        = _userService.FindUserByName(regModel.UserName);
                string callbackUrl = Url.Action("ConfirmEmail", "account", null, Request.Url.Scheme);
                await _userService.EmailConfirmed(user.Id, callbackUrl);

                _cusomerService.CreateCustomerProfile(user.Id);
                _commitProvider.SaveChanges();

                return(RedirectToAction("DisplayEmail", "account"));
            }

            AddModeErrors(regResult);
            return(View(regModel));
        }
Exemple #2
0
        public void CreateNotify(string reciverId, string text)
        {
            string senderId = User.Identity.GetUserId();

            _notificationService.CreateNotification(senderId, reciverId, text);
            _commitProvider.SaveChanges();

            _notificationService.RefreshNotifications(reciverId);
        }
Exemple #3
0
        public ActionResult CreateChatRoom(string userId)
        {
            string currentUserId = User.Identity.GetUserId();

            string[] usersId = new string[] { currentUserId, userId };

            _chatRoomService.CreateChatRoom(usersId);
            _notificationService.CreateNotification(currentUserId, userId, "You invited to chat room");
            _commitProvider.SaveChanges();

            _notificationService.RefreshNotifications(userId);
            return(ChatRooms());
        }
        public ActionResult Create(EmployeeProfileViewModel createModel)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.Skills = GetCategories();
                return(View(createModel));
            }

            string userId = User.Identity.GetUserId();

            _employeeService.CreateEmployeeProfile(userId, createModel.Age, createModel.AboutMe, createModel.SelectedSkills);
            _commitProvider.SaveChanges();

            return(RedirectToAction("settings", "account"));
        }
        public ActionResult CreateFeedBack(CreateFeedBackViewModel createModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(createModel));
            }

            string senderId     = User.Identity.GetUserId();
            var    createParams = new CreateFeedBackParams()
            {
                ReciverId     = createModel.ReciverId,
                SenderId      = senderId,
                JobId         = createModel.JobId,
                Text          = createModel.Text,
                QualityOfWork = (QualityOfWork)createModel.QualityOfWork
            };

            _feedBackService.CreateFeedBack(createParams);
            _notificationService.CreateNotification(senderId, createModel.ReciverId, "You write a review");
            _commitProvider.SaveChanges();

            _notificationService.RefreshNotifications(createModel.ReciverId);

            return(RedirectToAction("Jobs", "Job"));
        }
        public ActionResult Create(CreateOfferViewModel createModel)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(createModel));
            }

            string userId = User.Identity.GetUserId();

            CreateOfferParams createOfferParams = new CreateOfferParams()
            {
                EmployeeId = userId, JobId = createModel.JobId, Text = createModel.Text, ImplementationDays = createModel.DaysToImplement, OfferPayment = createModel.OfferPayment
            };

            _offerService.CreateOffer(createOfferParams);

            _commitProvider.SaveChanges();
            return(Redirect(Request.UrlReferrer.PathAndQuery));
        }
Exemple #7
0
        public ActionResult Create(CreateJobViewModel jobModel)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.Skills = GetCategories();
                return(View(jobModel));
            }

            CreateJobParams jobParams = new CreateJobParams()
            {
                CustomerId     = User.Identity.GetUserId(),
                SkillsId       = jobModel.SelectedSkills,
                Title          = jobModel.Title,
                Description    = jobModel.Description,
                Price          = jobModel.Price,
                PriceDiscussed = jobModel.PriceDiscussed
            };

            _jobService.CreateJob(jobParams);
            _commitProvider.SaveChanges();

            return(RedirectToAction("Jobs", "Job"));
        }
 public void Delete(string id)
 {
     _customerService.DeleteCustomerProfile(id);
     _commitProvider.SaveChanges();
 }
Exemple #9
0
 public void DeleteUser(string id)
 {
     _userService.DeleteUser(id);
     _commitProvider.SaveChanges();
 }