public async Task <ActionResult <MarkJournal> > PostMarkJournal(MarkJournal mark_journal) { _context.MarkJournal.Add(mark_journal); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMarkJournal", new { id = mark_journal.MarkJournalId }, mark_journal)); }
public async Task <IActionResult> PutMarkJournal(int id, MarkJournal mark_journal) { //if (id != mark_journal.MarkJournalId) //{ // return BadRequest(); //} mark_journal.MarkJournalId = id; _context.Entry(mark_journal).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MarkJournalExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private async Task View_Loading() { try { var main = View.Main; _usersJournal = new EmployeeJournal(main.DGV_Employees, true); _workingHoursJournal = new WorkingHourJournal(main.DGV_WorkingHours); _unitsJournal = new UnitJournal(main.DGV_Unit); _nomenclaturesJournal = new NomenclatureJournal(main.DGV_Nomenclatures); _optionsJournal = new OptionJournal(main.DGV_Options); _reasonsJournal = new ReasonJournal(main.DGV_Reasons); _marksJournal = new MarkJournal(main.DGV_Marks); _modelsJournal = new ModelJournal(main.DGV_Models); _contractorsJournal = new ContractorJournal(main.DGV_Contractors); _applicationsJournal = new ApplicationJournal(main.DGV_Apptications); using (var context = new DbSSContext()) { int countViewСontractor = await context.ViewСontractor.CountAsync(); int countTypeManifestation = await context.TypeManifestation.CountAsync(); int countTypeRepair = await context.TypeRepair.CountAsync(); var countTypeNomenclature = await context.TypeNomenclature.CountAsync(); if (countViewСontractor == 0) { List <ViewСontractorModel> view = new List <ViewСontractorModel>() { new ViewСontractorModel { View = "Юридическое лицо" }, new ViewСontractorModel { View = "Физическое лицо" } }; context.ViewСontractor.AddRange(view); } if (countTypeManifestation == 0) { List <TypeManifestationModel> type = new List <TypeManifestationModel>() { new TypeManifestationModel { Type = "Внешнее" }, new TypeManifestationModel { Type = "Втуреннее" } }; context.TypeManifestation.AddRange(type); } if (countTypeRepair == 0) { List <TypeRepairModel> type = new List <TypeRepairModel>() { new TypeRepairModel { Type = "Гарантийный" }, new TypeRepairModel { Type = "Текущий" } }; context.TypeRepair.AddRange(type); } if (countTypeNomenclature == 0) { List <TypeNomenclatureModel> type = new List <TypeNomenclatureModel>() { new TypeNomenclatureModel { Type = "Товар" }, new TypeNomenclatureModel { Type = "Работа" } }; context.TypeNomenclature.AddRange(type); } await context.SaveChangesAsync(); } await _applicationsJournal.Update(); } catch (Exception ex) { ShowError(ex.Message); } }