コード例 #1
0
        public IActionResult Edit([FromBody] ContactViewModel contactViewModel)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }
                contactViewModel.UpdatedOn = CurrentDateTimeHelper.GetCurrentDateTime();
                contactViewModel.UpdatedBy = UserHelper.CurrentUserGuid(HttpContext);
                var customerContactdetails = _customerContactService.GetDetailsById(contactViewModel.ContactGuid);

                var contact = ObjectMapper <ContactViewModel, CustomerContact> .Map(contactViewModel);

                contact.ContactTypeGuid = contactViewModel.ContactType;
                var customerContact = _customerContactService.Edit(contact);
                return(Ok(new { status = ResponseStatus.success.ToString(), message = "Successfully Updated !!", CustomerContact = new { SearchValue = " ", customerguid = contactViewModel.CustomerGuid, customerName = contactViewModel.CustomerName } }));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
コード例 #2
0
 private bool UpdateCustomerContactToDb(Core.Entities.CustomerContact customerContact)
 {
     _customerContactService.Edit(customerContact);
     return(true);
 }