Exemple #1
0
        public async Task <TEntity> AddAsync(TEntity entity)
        {
            await _repository.AddAsync(entity);

            await _unitOfWork.CommitAsync();

            return(entity);
        }
        public async Task <IActionResult> Add(CustomViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Add"));
            }

            await _customRepository.AddAsync(new Custom
            {
                Name           = model.Name,
                Contact_person = model.Contact_person,
                TitleId        = model.Title,
                Address        = model.Address,
                Postcode       = model.Postcode,
                Telphone       = model.Telphone,
                Fax            = model.Fax,
                Createdate     = DateTime.Now
            });

            return(RedirectToAction("Index"));
        }