public async Task <IActionResult> Create([Bind("Adress,Email,Image,AllowAnonymus,SortValue,Name,Description")] Publisher publisher) { if (ModelState.IsValid) { publisher.SelfInsight = false; publisher.GameId = (Guid)GameId(); publisher.Title = publisher.Name; _context.Add(publisher); await _context.SaveChangesAsync(); BaseTextProperty pseudonym = new BaseTextProperty { Name = $"Pseudonym for {publisher.Name}", DefaultValue = "Anonymus", GameId = publisher.GameId, PresetId = publisher.Id, Description = $"Псевдоним для публикации и комментирование в журнале {publisher.Name}" }; BaseNumericProperty quotum = new BaseNumericProperty { Name = $"Quota for publishing in {publisher.Name}", DefaultValue = 0, GameId = publisher.GameId, PresetId = publisher.Id, Description = $"Квота на публикации в журнале {publisher.Name}" }; _context.BaseProperties.Add(pseudonym); _context.BaseProperties.Add(quotum); await _context.SaveChangesAsync(); pseudonym.SortValue = pseudonym.Id; quotum.SortValue = quotum.Id; await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(publisher)); }
public async Task <IActionResult> CreateNumber([Bind("Name,Description,PresetId,Visible,DefaultValue")] BaseNumericProperty baseProperty) { return(await ManageCreation(baseProperty)); }
public async Task <IActionResult> EditNumber(long id, [Bind("Id,Name,GameId,Description,PresetId,SortValue,Visible,DefaultValue")] BaseNumericProperty baseProperty) { return(await ManageEditing(id, baseProperty)); }