public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Content,Type")] JobUnit jobUnit)
        {
            if (id != jobUnit.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(jobUnit);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JobUnitExists(jobUnit.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobUnit));
        }
 public async Task UpdateJobUnitControl(string identifier, JobUnit jobUnit, Status jobStatus)
 {
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         await JobsStackPanel.Children
         .Select(x => x as JobControl)
         .First(x => x.GetHashCode() == identifier.GetHashCode()).UpdateJobUnit(jobUnit, jobStatus);
     });
 }
        public async Task <IActionResult> Create([Bind("Id,Name,Content,Type")] JobUnit jobUnit)
        {
            if (ModelState.IsValid)
            {
                _context.Add(jobUnit);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(jobUnit));
        }
Exemple #4
0
 public JobUnitControl(JobUnit jobUnit)
 {
     this.InitializeComponent();
     JobUnit          = jobUnit;
     JobUnitName.Text = JobUnit.Name;
 }