Esempio n. 1
0
        public static ProjectVM ToModel(this Project entity, AdamUnit adamUnit)
        {
            var project = new ProjectVM();

            project.Id           = entity.Id;
            project.Name         = entity.Name;
            project.CustomerName = entity.Customer.FirstName;

            var IdsProjects = adamUnit.ProjectUserRepository.GetAll(x => x.ProjectId == entity.Id).Select(x => x.UserId);
            var listName    = " ";

            foreach (var id in IdsProjects)
            {
                var UserId = adamUnit.EmployeeRepository.SingleOrDefault(x => x.Id == id).UserId;
                var Name   = adamUnit.AppUserRepository.SingleOrDefault(x => x.Id == UserId).FirstName;
                listName += " " + Name;
            }
            project.EmplyeeName = listName;
            return(project);
        }
Esempio n. 2
0
        public static ProjectVM ToModelEmp(this Project entity, AdamUnit adamUnit, string CurrentUserId)
        {
            var EmployeeId  = adamUnit.EmployeeRepository.SingleOrDefault(x => x.UserId == CurrentUserId).Id;
            var project     = new ProjectVM();
            var ProjectUser = adamUnit.ProjectUserRepository.SingleOrDefault(x => x.ProjectId == entity.Id && x.UserId == EmployeeId);
            var listName    = " ";

            if (ProjectUser != null)
            {
                var UserId = adamUnit.EmployeeRepository.SingleOrDefault(x => x.Id == ProjectUser.UserId).UserId;
                if (UserId == CurrentUserId)
                {
                    var Name = adamUnit.AppUserRepository.SingleOrDefault(x => x.Id == UserId).FirstName;
                    listName           += " " + Name;
                    project.Id          = entity.Id;
                    project.Name        = entity.Name;
                    project.EmplyeeName = listName;
                }
            }

            return(project);
        }
Esempio n. 3
0
 public static Project ToModelEdit(this ProjectVM model, Project Project)
 {
     return(Mapper.Map(model, Project));
 }
Esempio n. 4
0
 public static Project ToEntity(this ProjectVM model)
 {
     return(Mapper.Map <Project>(model));
 }
Esempio n. 5
0
 public static ProjectVM ToModelDetails(this Project entity, ProjectVM model)
 {
     return(Mapper.Map(entity, model));
 }
Esempio n. 6
0
        public static ProjectVM ToModelReport(this Project entity, AdamUnit adamUnit, ProjectVM model)
        {
            model.Id   = entity.Id;
            model.Name = entity.Name;
            var listName = " ";

            foreach (var id in model.EmlpSelected)
            {
                var UserId = adamUnit.EmployeeRepository.SingleOrDefault(x => x.Id == id).UserId;
                var Name   = adamUnit.AppUserRepository.SingleOrDefault(x => x.Id == UserId).FirstName;
                listName += " " + Name;
            }
            model.EmplyeeName = listName;


            return(model);
        }