public IHttpActionResult GetContact([FromBody] ContactModel _Contact)
        {
            try
            {
                if (_Contact.Id > 0)
                {
                    var contact = _ContactModel.GetContactById(_Contact.Id);

                    if (contact != null)
                    {
                        return(Ok(contact));
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
                else
                {
                    return(BadRequest("The Contact Id is invalid"));
                }
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Beispiel #2
0
 public IActionResult DetailContact(int?id)
 {
     if (id == null)
     {
         return(View("~/Views/Shared/ErrorContact.cshtml"));
     }
     return(View(ContactModel.GetContactById((int)id)));
 }
Beispiel #3
0
 public IActionResult EditContact(int id)
 {
     return(View("FormsAddContact", ContactModel.GetContactById(id)));
 }