Example #1
0
 public static CommentUsersModel ConvertToCommentUsers(this tblCommentUser data)
 {
     return(new CommentUsersModel()
     {
         id = data.ID,
         commentId = data.CommentID,
         userId = data.UserID,
         user = data.tblUserProfile?.ConvertToUser(),
         isRead = data.IsRead,
         readBy = data.ReadBy,
         isActive = data.IsActive,
         isDeleted = data.IsDeleted,
         createdUserID = data.CreatedUserID,
         updatedUserID = data.UpdatedUserID,
         createdTimestamp = data.CreatedTimestamp,
         updatedTimestamp = data.UpdatedTimestamp
     });
 }
Example #2
0
        internal static async Task <tblCommentUser> InsertCommentUser(tblCommentUser model)
        {
            try
            {
                using (db = new eMSPEntities())
                {
                    model = db.tblCommentUsers.Add(model);

                    int x = await Task.Run(() => db.SaveChangesAsync());

                    return(model);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #3
0
        public async Task <CommentModel> CommentVacancy(VacancyCommentCreateModel data)
        {
            try
            {
                tblComment resComment = await Task.Run(() => ManageComments.InsertComment(data.comment.ConvertTotblComment()));

                data.vacancyComment.commentId = resComment.ID;

                tblVacancyComment res = await Task.Run(() => ManageVacancyComments.CommentVacancy(data.vacancyComment.ConvertTotblVacancyComment()));

                data.vacancyComment.Id = res.ID;

                data.commentUser.commentId = resComment.ID;
                tblCommentUser resCommentUser = await Task.Run(() => ManageComments.InsertCommentUser(data.commentUser.ConvertTotblCommentUser()));

                return(resComment.ConvertToComment());
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #4
0
        internal static async Task <VacancyCreateModel> Insert(VacancyCreateModel model)
        {
            try
            {
                using (db = new eMSPEntities())
                {
                    tblVacancy vacancy = await Task.Run(() => InsertVacancy(model.Vacancy.ConvertTotblVacancy()));

                    foreach (IndustrySkillsCreateModel a in model.VacancySkills)
                    {
                        await Task.Run(() => ManageVacancySkills.AddVacancySkills(a.id, vacancy));
                    }

                    foreach (CompanyCreateModel a in model.VacancySuppliers)
                    {
                        await Task.Run(() => ManageVacancySuppliers.InsertVacancySupplier(a.id, vacancy));
                    }

                    foreach (LocationCreateModel a in model.VacancyLocations)
                    {
                        await Task.Run(() => ManageVacancyLocations.AddVacancyLocation(a.locationId, vacancy));
                    }

                    foreach (VacancyFileModel a in model.VacancyFiles)
                    {
                        await Task.Run(() => ManageVacancyFiles.InsertVacancyFiles(a.ConvertTotblVacancyFile(), vacancy));
                    }

                    foreach (VacancyRequiredDocumentViewModel a in model.RequiredDocument.Where(x => x.IsSelected ?? false))
                    {
                        await Task.Run(() => ManageVacancyRequiredDocuments.AddVacanciesRequiredDocument(a.ConvertTotblVacanciesRequiredDocument(), vacancy));
                    }

                    foreach (VacancyQuestionViewModel a in model.Questions.Where(x => x.IsSelected ?? false))
                    {
                        await Task.Run(() => ManageVacancyQuestions.AddVacanciesQuestions(a.ConvertTotblVacanciesQuestion(), vacancy));
                    }

                    //Comments
                    foreach (CommentModel c in model.VacancyComment)
                    {
                        if (!string.IsNullOrEmpty(c.comment))
                        {
                            c.createdUserID    = vacancy.CreatedUserID;
                            c.createdTimestamp = vacancy.CreatedTimestamp;
                            c.updatedUserID    = vacancy.UpdatedUserID;
                            c.updatedTimestamp = vacancy.UpdatedTimestamp;
                            tblComment comment = await Task.Run(() => ManageComments.InsertComment(c.ConvertTotblComment()));

                            tblVacancyComment vc = db.tblVacancyComments.Add(new tblVacancyComment
                            {
                                CommentID        = comment.ID,
                                VacancyID        = vacancy.ID,
                                IsActive         = true,
                                IsDeleted        = false,
                                CreatedTimestamp = vacancy.CreatedTimestamp,
                                CreatedUserID    = vacancy.CreatedUserID,
                                UpdatedTimestamp = vacancy.UpdatedTimestamp,
                                UpdatedUserID    = vacancy.UpdatedUserID
                            });

                            tblVacancyComment resVC = await Task.Run(() => ManageVacancyComments.CommentVacancy(vc));

                            CommentUsersModel commentUM = new CommentUsersModel
                            {
                                commentId        = comment.ID,
                                userId           = vacancy.CreatedUserID,
                                isActive         = true,
                                isDeleted        = false,
                                createdTimestamp = vacancy.CreatedTimestamp,
                                createdUserID    = vacancy.CreatedUserID,
                                updatedTimestamp = vacancy.UpdatedTimestamp,
                                updatedUserID    = vacancy.UpdatedUserID
                            };

                            tblCommentUser resCommentUser = await Task.Run(() => ManageComments.InsertCommentUser(commentUM.ConvertTotblCommentUser()));
                        }
                    }
                    return(model);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }