コード例 #1
0
        /// <summary>
        /// update contact person
        /// </summary>
        /// <param name="contactPerson"></param>
        /// <returns></returns>
        public IHttpActionResult PutContactPerson(ContactPerson contactPerson)
        {
            if (!ModelState.IsValid)
                return BadRequest(ModelState);

            _contactPersonService.Update(contactPerson);
            var contactPersonDto = Mapper.Map<ContactPersonDTO>(contactPerson);
            return Ok(new
            {
                data = contactPersonDto
            });
        }
コード例 #2
0
        /// <summary>
        /// create a new contact person
        /// </summary>
        /// <param name="contactPerson"></param>
        /// <returns></returns>
        public IHttpActionResult PostContactPerson(ContactPerson contactPerson)
        {
            if (!ModelState.IsValid)
                return BadRequest(ModelState);

            contactPerson.CreateDate = DateTime.Today;
            var addedPerson = _contactPersonService.Add(contactPerson);
            var contactPersonDto = Mapper.Map<ContactPersonDTO>(addedPerson);
            return Ok(new
            {
                data = contactPersonDto
            });
        }