public IActionResult AddTaskInformation([FromForm] GetTaskInformation c) { ContactDetails cdetails = new ContactDetails(); // cdetails.ContactId = c.ContactId; cdetails.Name = c.Name; cdetails.Number1 = c.Contact1; cdetails.Number2 = c.Contact2; cdetails.Address = c.Address; cdetails.ContactDescription = c.ContactDescription; cdetails.ContactDetailId = c.ContactId; cdetails.ContactId.ContactId = c.ContactId; int contactId = _contactService.AddContactDetail(cdetails); if (contactId != 0) { TaskInformation taskinfo = new TaskInformation(); taskinfo.ContactId.ContactId = contactId; taskinfo.InfoDescription = c.InfoDescription; taskinfo.Id.Id = c.EmpId; taskinfo.IsComplete = c.IsComplete; _service.AddTaskInformation(taskinfo); return(Ok(c)); } else { return(BadRequest("error")); } /* if (_service.AddContactDetail(c)) * { * * return Ok(c); * } * else * { * return BadRequest("error"); * }*/ }