public static BL.ProjectInfo MapMvcToBusiness(MVC.ProjectInfo source)
 {
     if (source == null)
     {
         return(null);
     }
     BL.ProjectInfo target = BL.ProjectInfo.GetOrCreate(MapSupport.ActiveCtx, source.ProjectInfoId);
     if (target.Version != Guid.Empty && target.Version != source.ProjectInfoVersion)
     {
         throw new DataException("Concurrency check failed");
     }
     if (source.ProjectInfoIsDeleted)
     {
         target.Delete(MapSupport.ActiveCtx);
         return(null);
     }
     else
     {
         target.Version                    = source.ProjectInfoVersion;
         target.Name                       = source.ProjectInfoName;
         target.ResponsibleUnitName        = source.ProjectInfoResponsibleUnitName;
         target.ResponsiblePersonName      = source.ProjectInfoResponsiblePersonName;
         target.FocusedYear                = source.ProjectInfoFocusedYear;
         target.FocusedYearBudgetEuros     = source.ProjectInfoFocusedYearBudgetEuros;
         target.FocusedYearEstimateEuros   = source.ProjectInfoFocusedYearEstimateEuros;
         target.CommittedBudgetForNextYear = source.ProjectInfoCommittedBudgetForNextYear;
         target.WholeDurationRange         = source.ProjectInfoWholeDurationRange;
     }
     return(target);
 }
 public ActionResult Create(Project project, ProjectInfo projectInfo, ProjectStatusInfo projectStatusInfo)
 {
     try
     {
         project.ProjectInfo = projectInfo;
         project.ProjectStatusInfo = projectStatusInfo;
         BL.Project blProject = MAP.MapProject.MapMvcToBusiness(project);
         MAP.MapSupport.ActiveCtx.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
        public static MVC.ProjectInfo MapBusinessToMvc(BL.ProjectInfo source)
        {
            if (source == null)
            {
                return(null);
            }
            MVC.ProjectInfo target = new MVC.ProjectInfo();
            target.ProjectInfoId                         = source.Id;
            target.ProjectInfoVersion                    = source.Version;
            target.ProjectInfoName                       = source.Name;
            target.ProjectInfoResponsibleUnitName        = source.ResponsibleUnitName;
            target.ProjectInfoResponsiblePersonName      = source.ResponsiblePersonName;
            target.ProjectInfoFocusedYear                = source.FocusedYear;
            target.ProjectInfoFocusedYearBudgetEuros     = source.FocusedYearBudgetEuros;
            target.ProjectInfoFocusedYearEstimateEuros   = source.FocusedYearEstimateEuros;
            target.ProjectInfoCommittedBudgetForNextYear = source.CommittedBudgetForNextYear;
            target.ProjectInfoWholeDurationRange         = source.WholeDurationRange;


            return(target);
        }
        public static MVC.ProjectInfo MapBusinessToMvc(BL.ProjectInfo source)
        {
            if(source == null)
                    return null;
                MVC.ProjectInfo target = new MVC.ProjectInfo();
                    target.ProjectInfoId = source.Id;
                target.ProjectInfoVersion = source.Version;
                target.ProjectInfoName = source.Name;
                target.ProjectInfoResponsibleUnitName = source.ResponsibleUnitName;
                target.ProjectInfoResponsiblePersonName = source.ResponsiblePersonName;
                target.ProjectInfoFocusedYear = source.FocusedYear;
                target.ProjectInfoFocusedYearBudgetEuros = source.FocusedYearBudgetEuros;
                target.ProjectInfoFocusedYearEstimateEuros = source.FocusedYearEstimateEuros;
                target.ProjectInfoCommittedBudgetForNextYear = source.CommittedBudgetForNextYear;
                target.ProjectInfoWholeDurationRange = source.WholeDurationRange;

                return target;
        }