Ejemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            CommonAreaAsset = await _context.CommonAreaAsset.FirstOrDefaultAsync(m => m.CommonAreaAssetID == id).ConfigureAwait(false);

            if (CommonAreaAsset == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CommonAreaAsset = await _context.CommonAreaAsset.FindAsync(id).ConfigureAwait(false);

            CommonAreaAsset.Status           = (CommonAreaAsset.Status == "Active") ? "Disabled" : "Active";
            CommonAreaAsset.LastModifiedDate = DateTime.Now;
            var user = _context.Owner.FirstOrDefault(x => x.User.UserID == HttpContext.Session.GetInt32("SessionUserID"));

            CommonAreaAsset.LastModifiedBy = user != null ? user.Initials : "SYS";

            if (CommonAreaAsset != null)
            {
                await _context.SaveChangesAsync().ConfigureAwait(false);
            }

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