Пример #1
0
        public ActionResult Create(Project Project, int[] projectFile, int[] supportingFile)
        {
            try
            {
                try
                {
                    // TODO: Add update logic here
                    Project.Created     = DateTime.Now;
                    Project.Createdby   = AppSession.UserId;
                    Project.Modified    = DateTime.Now;
                    Project.Modifiedby  = AppSession.UserId;
                    Project.RegionId    = Convert.ToInt32(Project.Region.Id);
                    Project.SubRegionId = Convert.ToInt32(Project.SubRegion.Id);
                    _dbContextHelper.AttachToContext(Project);

                    foreach (int fle in projectFile)
                    {
                        ProjectDocumentInfo pfle = new ProjectDocumentInfo();
                        pfle.ProjectId         = Project.Id;
                        pfle.ProjectDocumentId = fle;
                        _dbContextHelper.AttachToContext(pfle);
                    }

                    foreach (int sfle in supportingFile)
                    {
                        SupportingDocumentInfo spfle = new SupportingDocumentInfo();
                        spfle.ProjectId            = Project.Id;
                        spfle.SupportingDocumentId = sfle;
                        _dbContextHelper.AttachToContext(spfle);
                    }
                }
                catch (Exception ex)
                {
                    return(View());
                }
                IntializeViewdata();
                return(View("ngCreate"));
            }
            catch
            {
                return(View());
            }
        }