Esempio n. 1
0
        public int createContactByEnt(ContactRequest contact)
        {
            var User       = _dbContext.Users.FirstOrDefault(u => u.ID == contact.UserID);
            var Post       = _dbContext.Posts.Include(p => p.Enterprise).FirstOrDefault(p => p.ID == contact.PostID);
            var entID      = Post.Enterprise.ID;
            var ent        = _dbContext.Enterprises.Include(e => e.EnterpriseInfo).FirstOrDefault(e => e.ID == entID);
            var oldContact = _dbContext.Contacts.FirstOrDefault(c => c.User.ID == User.ID && c.Post.ID == Post.ID);

            if (oldContact is null)// Chưa có contact
            {
                var Contact = new Contact()
                {
                    CompanyName = ent.EnterpriseInfo.Company_Name,
                    Type        = 1,
                    User        = User,
                    Post        = Post,
                    Result      = "pending"
                };
                _dbContext.Contacts.Add(Contact);
                return(_dbContext.SaveChanges());
            }
            else
            {
                return(0);
            }
        }
Esempio n. 2
0
        public int editPost(PostInfo info)
        {
            var post = _dbContext.Posts.FirstOrDefault(p => p.ID == info.PostID);

            post.Title           = info.Title;
            post.Address         = info.Address;
            post.ExactAddress    = info.ExactAddress;
            post.Position        = info.Position;
            post.Gender          = info.Gender;
            post.Salary          = info.Salary;
            post.Amount          = info.Amount;
            post.Experience      = info.Experience;
            post.Reciever        = info.Reciever;
            post.Phone_Reciever  = info.Phone_Reciever;
            post.Email_Reciever  = info.Email_Reciever;
            post.Description     = info.Description;
            post.Require         = info.Require;
            post.Benefit         = info.Benefit;
            post.Skill           = info.Skill;
            post.Submit_Deadline = info.Submit_Deadline;
            return(_dbContext.SaveChanges());
        }