public IActionResult AddSubscriber(Subscriber subscriber) { var ip_address = HttpContext.Connection.RemoteIpAddress.ToString(); subscriber.IpAddress = ip_address; if (string.IsNullOrEmpty(subscriber.Name)) { subscriber.Name = "NA"; } if (repositoryData.IsSubscriberExist(subscriber.EmailId)) { return(Json(new { success = false, message = "Emailid already subscribed." })); } repositoryData.AddSubscriber(subscriber); repositoryData.Commit(); return(Json(new { success = true, message = "Thank you for subscribing us." })); //return new ContentResult //{ // StatusCode = 200, // ContentType = "application/xml", // Content = strContent, //}; }