Example #1
0
 public void Create(Project_StatusViewModel model)
 {
     using (unitOfWork = new UnitOfWork())
     {
         Project_Status modelMapping = Mapper.Map <Project_StatusViewModel, Project_Status>(model);
         unitOfWork.ProjectStatusReporitory.Insert(modelMapping);
         unitOfWork.ProjectStatusReporitory.Save();
     }
 }
Example #2
0
        public Project_StatusViewModel Get(int id)
        {
            using (unitOfWork = new UnitOfWork())
            {
                Project_Status          model       = unitOfWork.ProjectStatusReporitory.GetById(id);
                Project_StatusViewModel modelMappig = Mapper.Map <Project_Status, Project_StatusViewModel>(model);

                modelMappig.ProjectViewModels = Mapper.Map <ICollection <Project>, ICollection <ProjectViewModel> >(model.Projects);

                return(modelMappig);
            }
        }
        public object GetStatus(int id)
        {
            ResponseDetails responseDetails = new ResponseDetails();

            try
            {
                Project_StatusViewModel model = projectStatusService.Get(id);
                responseDetails = Helper.SetResponseDetails("", true, model, MessageType.Success);
            }
            catch (Exception ex)
            {
                responseDetails = Helper.SetResponseDetails("Exception encuntered : " + ex.Message, false, ex, MessageType.Error);
            }

            return(responseDetails);
        }
        public object CreateStatus(Project_StatusViewModel model)
        {
            ResponseDetails responseDetails = new ResponseDetails();

            try
            {
                projectStatusService.Create(model);
                responseDetails = Helper.SetResponseDetails("Status created successfully.", true, null, MessageType.Success);
            }
            catch (Exception ex)
            {
                responseDetails = Helper.SetResponseDetails("Exception encuntered : " + ex.Message, false, ex, MessageType.Error);
            }

            return(responseDetails);
        }
Example #5
0
        public List <Project_StatusViewModel> GetAll()
        {
            using (unitOfWork = new UnitOfWork())
            {
                List <Project_Status>          model        = unitOfWork.ProjectStatusReporitory.GetAll();
                List <Project_StatusViewModel> modelMapping = new List <Project_StatusViewModel>();

                for (int i = 0; i < model.Count; i++)
                {
                    Project_StatusViewModel status = Mapper.Map <Project_Status, Project_StatusViewModel>(model[i]);
                    status.ProjectViewModels = Mapper.Map <ICollection <Project>, ICollection <ProjectViewModel> >(model[i].Projects);

                    modelMapping.Add(status);
                }

                return(modelMapping);
            }
        }