public HttpResponseMessage AddEdit(int userId, string name, string code, DateTime financialPeriodDateStart, DateTime financialPeriodDateEnd, bool isDefault) { var repo = new CountryRepository(); var itm = new Country(); itm.UserId = userId; itm.Name = name; itm.Code = code; itm.IsDefault = isDefault; itm.CountryFinancialPeriod.DateStart = financialPeriodDateStart; itm.CountryFinancialPeriod.DateEnd = financialPeriodDateEnd; var entity = repo.AddEdit(itm); var json = JsonConvert.SerializeObject(entity); return(new HttpResponseMessage { Content = new StringContent(json, Encoding.UTF8, "application/json") }); }