Beispiel #1
0
        public HttpResponseMessage Put(int id, [FromBody] StateContactModel value)
        {
            var contact = stateRepository.GetStates().SelectMany(x => x.StateLeadContacts).FirstOrDefault(x => x.LeadContactId == id);

            contact.Name       = value.Name;
            contact.Phone_     = value.Phone;
            contact.Role       = value.Role;
            contact.Email      = value.Email;
            contact.Additional = value.AdditionalInfo;
            contact.Fax        = value.Fax;

            return(Request.CreateResponse(HttpStatusCode.OK, stateRepository.Save()));
        }
Beispiel #2
0
        public HttpResponseMessage AddContact([FromUri] int id, [FromBody] StateContactModel value)
        {
            var contact = new StateLeadContact()
            {
                StateId    = id,
                Name       = value.Name,
                Phone_     = value.Phone,
                Role       = value.Role,
                Email      = value.Email,
                Additional = value.AdditionalInfo,
                Fax        = value.Fax
            };

            stateRepository.AddContact(contact);


            return(ToJson(stateRepository.Save()));
        }