Beispiel #1
0
        public void Callback(string phone, string url)
        {
            if (string.IsNullOrEmpty(phone))
            {
                return;
            }

            DateTime creationTime = DateTime.Now.ToUkrainianTimeZone();
            string   telephone    = phone.Trim();

            try
            {
                callbackRepository.Add(new Callback
                {
                    CreateTime = creationTime,
                    Phone      = telephone,
                    Status     = Status.Pending,
                    Url        = url
                });

                using (UnitOfWork)
                {
                    UnitOfWork.Commit();
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
                throw;
            }
        }
Beispiel #2
0
        public IActionResult Create(CreateCallbackVM model)
        {
            if (ModelState.IsValid)
            {
                var entity = _mapper.Map <Callback>(model);
                entity.CreatedDate = DateTimeOffset.Now;
                entity.IsProcessed = false;
                _callbackRepository.Add(entity);
                _unitOfWork.Commit();

                return(RedirectToAction("Index", "Home"));
            }

            return(View(model));
        }