Example #1
0
        public async Task <IActionResult> Post([FromBody] CallViewModel callViewModel)
        {
            if (ModelState.IsValid)
            {
                //Save To Db
                Call _call = _mapper.Map <CallViewModel, Call>(callViewModel);
                _call.Campaign = null;
                _call.Customer = null;
                _callRepository.Add(_call);

                if (await _callRepository.Commit())
                {
                    callViewModel = _mapper.Map <Call, CallViewModel>(_call);
                    //return Created($"api/customer/{customerModel.Name}", Mapper.Map<CustomerViewModel>(_customer));
                    CreatedAtRouteResult result = CreatedAtRoute("GetCustomer", new { controller = "Call", id = callViewModel.Id }, callViewModel);
                    return(result);
                }
            }
            return(BadRequest("Failed To Save the Call"));
        }
Example #2
0
 private int RegisterCallRecord(string userName, IDepartment department)
 {
     return(callRepository.Add(userName, Name, department.GetType().Name, State.InProcess.ToString()));
 }