Ejemplo n.º 1
0
        public async Task <bool> Add(Order model)
        {
            model.OrderCode = _common.GenerateCodeString(8).Replace("-", "X");
            await _context.AddAsync(model);

            return(await _context.SaveChangesAsync() > 0);
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> Add(Cupon model)
 {
     model.Code = _common.GenerateCodeString(5);
     if (ModelState.IsValid)
     {
         if (await _service.Add(model))
         {
             TempData["Cuppon"] = "Agregado Correctamente";
             return(RedirectToAction("Cupons", "Admin"));
         }
         TempData["Cuppon"] = "Ha ocurrido un error al agregar";
     }
     return(View(model));
 }