コード例 #1
0
        public async Task <IActionResult> Create(SuObjectAndStatusViewModel FromForm)
        {
            if (ModelState.IsValid)
            {
                var Project = new SuProjectModel
                {
                    ModifiedDate    = DateTime.Now,
                    CreatedDate     = DateTime.Now,
                    ProjectStatusId = FromForm.SuObject.Status
                };
                if (FromForm.SuObject.NullId != 0)
                {
                    Project.ParentProjectId = FromForm.SuObject.NullId;
                }
                var NewProject = _Project.AddProject(Project);


                var CurrentUser = await _userManager.GetUserAsync(User);

                var ProjectLanguage = new SuProjectLanguageModel
                {
                    Name        = FromForm.SuObject.Name,
                    Description = FromForm.SuObject.Description,
                    MouseOver   = FromForm.SuObject.MouseOver,
                    ProjectId   = NewProject.Id,
                    LanguageId  = CurrentUser.DefaultLanguageId
                };
                _ProjectLanguage.AddProjectLanguage(ProjectLanguage);
            }
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public SuProjectLanguageModel UpdateProjectLanguage(SuProjectLanguageModel suProjectLanguageChanges)
        {
            var changedProjectLanguage = context.DbProjectLanguage.Attach(suProjectLanguageChanges);

            changedProjectLanguage.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            context.SaveChanges();
            return(suProjectLanguageChanges);
        }
コード例 #3
0
        public IActionResult LanguageCreate(SuObjectLanguageEditGetWitLanguageListModel FromForm)
        {
            if (ModelState.IsValid)
            {
                var ProjectLanguage = new SuProjectLanguageModel
                {
                    Name        = FromForm.SuObject.Name,
                    Description = FromForm.SuObject.Description,
                    MouseOver   = FromForm.SuObject.MouseOver,
                    ProjectId   = FromForm.SuObject.OId,
                    LanguageId  = FromForm.SuObject.LanguageId
                };

                _ProjectLanguage.AddProjectLanguage(ProjectLanguage);
            }
            return(RedirectToAction("LanguageIndex", new { Id = FromForm.SuObject.OId.ToString() }));
        }
コード例 #4
0
 public SuProjectLanguageModel AddProjectLanguage(SuProjectLanguageModel suProjectLanguage)
 {
     context.DbProjectLanguage.Add(suProjectLanguage);
     context.SaveChanges();
     return(suProjectLanguage);
 }