Пример #1
0
        public IActionResult About(WelcomeModel model)
        {
            WelcomeModel user = null;

            using (var db = new WelcomeContext())
            {
                user         = db.welcomers.Where(x => x.name == model.name && x.profession == model.profession).FirstOrDefault();
                user.lastout = DateTime.Now;
            }
            AddDataInVisit(user);
            using (var db = new VisitContext())
            {
                db.Update(user);
            }
            return(View());
        }
Пример #2
0
        public async Task <TEntity> UpdateAsync(TEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException($"{nameof(AddAsync)} entity must not be null");
            }

            try
            {
                VisitContext.Update(entity);
                await VisitContext.SaveChangesAsync();

                return(entity);
            }
            catch (Exception ex)
            {
                throw new Exception($"{nameof(entity)} could not be updated {ex.Message}");
            }
        }