示例#1
0
        public TEntity Update(TEntity entity)
        {
            TEntity updateEntity = _repository.Update(entity);

            //_unitOfWork.Commit();
            return(updateEntity);
        }
        public ActionResult EditAuthor(long id, AuthorViewModel model)
        {
            Author author = _repoAuthor.GetById(id);

            try
            {
                if (author != null)
                {
                    author.FirstName    = model.FisrtName;
                    author.LastName     = model.LastName;
                    author.Email        = model.Email;
                    author.IpAddress    = Request.HttpContext.Connection.RemoteIpAddress.ToString();
                    author.ModifiedDate = DateTime.UtcNow;
                    _repoAuthor.Update(author);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error" + ex.Message);
            }
            return(RedirectToAction("Index"));
        }