Ejemplo n.º 1
0
        public async Task <IActionResult> PutComputerID([FromRoute] Guid id, [FromBody] ComputerID computerID)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != computerID.ID)
            {
                return(BadRequest());
            }

            _context.Entry(computerID).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ComputerIDExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(SubCategories).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                if (!SubCategoriesExists(SubCategories.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            await _context.Clients.AddAsync(Clients);

            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            SubCategories.TenantID = _config.Value.Debug.TenantID;

            await _context.SubCategories.AddAsync(SubCategories);

            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            Techs.DateLogged = DateTime.Now;
            Techs.ID         = Guid.NewGuid();

            await _context.Techs.AddAsync(Techs);

            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> OnPostAsync(Guid id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            //SubCategories = await _context.SubCategories.FindAsync(id);
            SubCategories = await _context.SubCategories
                            .Where(x => x.TenantID == _options.Value.Debug.TenantID)
                            .FirstOrDefaultAsync();

            if (SubCategories != null)
            {
                _context.SubCategories.Remove(SubCategories);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> OnPostUpdateStatusAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(TicketInformation).State = EntityState.Modified;
            var z = await _context.Tickets
                    .SingleOrDefaultAsync(x => x.ID == TicketInformation.ID);

            if (z != null)
            {
                if (TicketInformation.Status.ToString() == "Resolved")
                {
                    z.DateTimeFinished = DateTime.Now;
                }

                z.Status = TicketInformation.Status;
                _context.Update(z);
            }

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TicketsInformationExists(TicketInformation.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Page());
            //return Redirect($"./Tickets");
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> OnPostAsync(Guid id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            if (ViewAction.Equals("delete"))
            {
                Cli = await _context.Clients
                      .Where(x => x.TenantID == _options.Value.Debug.TenantID)
                      .Where(x => x.ID == id)
                      .FirstOrDefaultAsync();

                if (Cli != null)
                {
                    _context.Clients.Remove(Cli);
                    await _context.SaveChangesAsync();
                }
            }
            else if (ViewAction.Equals("edit"))
            {
                //need the _id to update
                var rec = _context.Clients.Where(x => x.ID == id);
                //Cli.ID = rec.ID;

                try
                {
                    //await _context.Clients.UpdateAsync(rec.ID, Cli);
                    //await _context.SaveChangesAsync();
                }
                catch (Exception ex)
                {
                }
            }


            return(RedirectToPage("./Index"));
        }