Beispiel #1
0
        public IActionResult SaveAuction(Auction Auction)
        {
            var Freelance_ID = HttpContext.Session.GetInt32("Freelance_ID");
            var _Auction     = new Auction
            {
                Freelance_ID = (int)Freelance_ID,
                Project_ID   = Auction.Project_ID,
                Price        = Auction.Price,
                AuctionTime  = Auction.AuctionTime,
                Date_Create  = DateTime.Now,
            };
            var Project      = _context.Project.SingleOrDefault(p => p.Project_ID == Auction.Project_ID);
            var Notification = new Notification
            {
                Project_ID       = Auction.Project_ID,
                Company_ID       = Project.Company_ID,
                Employer_ID      = Project.Employer_ID,
                Freelance_ID     = Freelance_ID,
                NotificationCode = "01",
                ReadStatus       = false,
                Date_Create      = DateTime.Now,
                DelStatus        = false,
            };

            _context.Auction.Add(_Auction);
            _context.Notification.Add(Notification);
            _context.SaveChanges();
            return(Json(new { Result = Notification }));
        }
        public async Task <IActionResult> SaveProjectCompany(Project Project, int[] skillList, Boolean check1, Boolean check2)
        {
            var _Project = new Project
            {
                Company_ID           = (int)HttpContext.Session.GetInt32("Company_ID"),
                ProjectName          = Project.ProjectName,
                Description          = Project.Description,
                TypeProject_ID       = Project.TypeProject_ID,
                Budget               = Project.Budget,
                Timelength           = Project.Timelength,
                StartingDate         = Project.StartingDate,
                EndDate              = Project.EndDate,
                ProjectStatus        = true,
                ProjectAuctionStatus = false,
                ProjectTimeOut       = DateTime.Now.AddDays(15),
                Date_Create          = DateTime.Now,
                Date_Update          = DateTime.Now,
                DelStatus            = false,
            };

            if (check1)
            {
                _Project.StartingDate         = DateTime.Now;
                _Project.ProjectAuctionStatus = true;
            }
            if (check2)
            {
                _Project.EndDate = DateTime.Now.AddDays(15);
            }
            _context.Project.Add(_Project);
            await _context.SaveChangesAsync();

            int id = _Project.Project_ID;

            foreach (var skillLists in skillList)
            {
                var _ProjectSkill = new ProjectSkill
                {
                    Skill_ID    = skillLists,
                    Project_ID  = id,
                    Date_Create = DateTime.Now,
                    Date_Update = DateTime.Now,
                    DelStatus   = false,
                };
                _context.ProjectSkill.Add(_ProjectSkill);
                _context.SaveChanges();
            }
            return(Json(new { _Project }));
        }
Beispiel #3
0
        public IActionResult NotificationChRead()
        {
            var Employer_ID  = HttpContext.Session.GetInt32("Employer_ID");
            var Notification = _context.Notification.Where(n => n.Employer_ID == Employer_ID && n.NotificationCode != "03" && n.NotificationCode != "04").ToList();

            foreach (var Notifications in Notification)
            {
                Notifications.ReadStatus = true;
                _context.Update(Notifications);
                _context.SaveChanges();
            }
            return(Json("OK"));
        }
        public IActionResult RemoveProject(int id)
        {
            var project = _context.Project.SingleOrDefault(p => p.Project_ID == id);

            project.DelStatus = true;

            _context.Project.Update(project);
            _context.SaveChanges();
            var Admin_ID = HttpContext.Session.GetInt32("Admin_ID");

            return(RedirectToAction("Project", "Admin", new { id = Admin_ID }));
        }