Example #1
0
 public static DTOCoat ToDTO(this CoatModel model)
 {
     return(new DTOCoat()
     {
         Id = model.Id,
         Name = model.Name
     });
 }
Example #2
0
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CoatModel = await _context.CoatModel
                        .Include(c => c.Coat).FirstOrDefaultAsync(m => m.Id == id);

            if (CoatModel == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Example #3
0
        public async Task <IActionResult> OnPostAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CoatModel = await _context.CoatModel.FindAsync(id);

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

            return(RedirectToPage("./Index"));
        }
Example #4
0
        public async Task <IActionResult> OnGetAsync(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CoatModel = await _context.CoatModel
                        .Include(c => c.Coat).FirstOrDefaultAsync(m => m.Id == id);

            if (CoatModel == null)
            {
                return(NotFound());
            }
            ViewData["CoatId"] = new SelectList(_context.Coat, "Id", "Brand");
            return(Page());
        }