Exemple #1
0
 public ActionResult Get()
 {
     return(Ok(new
     {
         Guid = guidService.GetGuid(),
         SingletonGuid = service.GetGuid()
     }));
 }
        public IEnumerable <Guid> GetGuidList()
        {
            var middlewareGuid = (Guid)HttpContext.Items["guid"];

            var guidList = new List <Guid>()
            {
                _guidService.GetGuid(),
                middlewareGuid
            };

            return(guidList);
        }
Exemple #3
0
        public IActionResult OnPost(int restaurantId)
        {
            try
            {
                var restaurant = restaurantData.Delete(restaurantId);
                restaurantData.Commit();

                if (restaurant == null)
                {
                    return(RedirectToPage("./NotFound"));
                }

                TempData["Message"] = $"{restaurant.Name} deleted !!";
                return(RedirectToPage("./List"));
            }
            catch (Exception ex)
            {
                throw new Exception($"Some error has occuured : {guidService.GetGuid()}");
            }
        }
Exemple #4
0
 public async Task Invoke(HttpContext httpContext, IGuidService service)
 {
     httpContext.Items["guid"] = service.GetGuid();
     await _next(httpContext);
 }
Exemple #5
0
 public SingletonService(IGuidService service)
 {
     _guid = service.GetGuid();
 }
 public IActionResult CtorInterface()
 {
     ViewBag.GuidString = _iguidService.GetGuid();
     return(View());
 }