public ActionResult InsertEducation(Education education) { ZonaFl.Persistence.Entities.AspNetUsers useru = null; ZonaFl.Business.SubSystems.SUser usern = new Business.SubSystems.SUser(); useru = usern.GetCurriculumUserById(new Guid(education.UserId)); List <Persistence.Entities.Education> educations = new List <Persistence.Entities.Education>(); CultureInfo provider = CultureInfo.CurrentCulture; SCountry sco = new SCountry(); if (education.Institution != null) { Persistence.Entities.Education education1 = new ZonaFl.Persistence.Entities.Education() { Institution = education.Institution, Country = sco.FindCountrybyName(education.Country).Id, Title = education.Title, DateIni = DateTime.Parse(education.DateIniE, provider), DateEnd = DateTime.Parse(education.DateEndE, provider), Actually = education.Actually, UserId = education.UserId }; educations.Add(education1); } if (education.Institution2 != null) { Persistence.Entities.Education education2 = new ZonaFl.Persistence.Entities.Education() { Institution = education.Institution2, Country = education.Country2 != null?sco.FindCountrybyName(education.Country2).Id : -1, Title = education.Title2, DateIni = DateTime.Parse(education.DateIni2E), DateEnd = DateTime.Parse(education.DateEnd2E), Actually = education.Actually2, UserId = education.UserId }; educations.Add(education2); } if (education.Institution3 != null) { Persistence.Entities.Education education3 = new ZonaFl.Persistence.Entities.Education() { Institution = education.Institution3, Country = education.Country3 != null?sco.FindCountrybyName(education.Country3).Id : -1, Title = education.Title3, DateIni = DateTime.Parse(education.DateIni3E), DateEnd = DateTime.Parse(education.DateEnd3E), Actually = education.Actually3, UserId = education.UserId }; educations.Add(education3); } bool rta = usern.InsertEducation(educations); return(Json(data: rta)); }
public string GetCountry(string token, int id, Culture culture = Culture.En) { if (!CheckToken(token)) { return(null); } return(ToJson(SCountry.Convert(HttpContext, DataManager.Countries.GetCountry(id), culture))); }
public string GetCountries(string token, int offset = 0, int count = 20, string search = null, Culture culture = Culture.En, Order order = Order.Default) { if (!CheckToken(token)) { return(null); } return(ToJson(SCountry.Convert(HttpContext, DataManager.Countries.GetCountries(offset, count, culture, search, order), culture))); }
public ActionResult GetEducationByUser() { var iduser = RouteData.Values["id"].ToString(); ZonaFl.Business.SubSystems.SUser usern = new Business.SubSystems.SUser(); List <Persistence.Entities.Education> educations = usern.GetEducationByUser(iduser); Models.Education educationsm = new Education(); SCountry sco = new SCountry(); int i = 0; foreach (var edu in educations) { if (i == 0) { int contry = edu.Country != null?(int)edu.Country:-1; educationsm.Institution = edu.Institution; educationsm.Country = edu.Country != null?sco.FindCountrybyId(contry).Name : ""; educationsm.DateEndE = edu.DateEnd.ToString(); educationsm.DateIniE = edu.DateIni.ToString(); educationsm.Actually = edu.Actually == null? false : (bool)edu.Actually; educationsm.Title = edu.Title; educationsm.UserId = iduser; } if (i == 1) { int contry2 = edu.Country != null ? (int)edu.Country : -1; educationsm.Institution2 = edu.Institution; educationsm.Country2 = edu.Country != null?sco.FindCountrybyId(contry2).Name : ""; educationsm.DateEnd2E = edu.DateEnd.ToString(); educationsm.DateIni2E = edu.DateIni.ToString(); educationsm.Actually2 = edu.Actually == null ? false : (bool)edu.Actually; educationsm.Title2 = edu.Title; } if (i == 2) { int contry3 = edu.Country != null ? (int)edu.Country : -1; educationsm.Institution3 = edu.Institution; educationsm.Country3 = edu.Country != null?sco.FindCountrybyId(contry3).Name : ""; educationsm.DateEnd3E = edu.DateEnd.ToString(); educationsm.DateIni3E = edu.DateIni.ToString(); educationsm.Actually3 = edu.Actually == null ? false : (bool)edu.Actually; educationsm.Title3 = edu.Title; } i += 1; } return(Json(educationsm, JsonRequestBehavior.AllowGet)); }
public JsonResult FindCitiesByCountry(int countryId) { List <City> citylist = new List <City>(); SCountry sco = new SCountry(); citylist = sco.FindCitiesByCountry(countryId); return(new JsonResult { Data = citylist, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult Get(int id) { List <City> citylist = new List <City>(); SCountry sco = new SCountry(); citylist = sco.FindCitiesByCountry(id); List <Models.City> citiesm = new List <Models.City>(); citiesm = citylist.Select(e => new Models.City().InjectFrom(e)).Cast <Models.City>().ToList(); //return new JsonResult { Data = citylist, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; //return citiesm; return(this.Json(citiesm, JsonRequestBehavior.AllowGet)); }
public JsonResult Get(string name) { List <City> citylist = new List <City>(); SCountry sco = new SCountry(); System.Char delimiter = '-'; var ciudad = sco.FindCityByName(name.Split(delimiter)[1]); citylist = sco.FindCitiesByCountry(int.Parse(name.Split(delimiter)[0])).Where(e => e.Id != ciudad.Id).ToList(); citylist.Insert(0, ciudad); return(new JsonResult { Data = citylist, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public JsonResult Get() { List <Models.Country> countrylist = new List <Models.Country>(); SCountry sco = new SCountry(); List <Country> countries = sco.FindAll(); //var ret = countries.Select(x => new { x.Id, x.Name }).ToList(); foreach (Country country in countries) { countrylist.Add(new Models.Country() { CountryID = country.Id, CountryName = country.Name }); } return(new JsonResult { Data = countrylist, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult Get(string SelectedCountryId) { List <Models.Country> countrylist = new List <Models.Country>(); SCountry sco = new SCountry(); List <Country> countries = sco.FindAll(); Country countryr = sco.FindCountrybyId(int.Parse(SelectedCountryId)); Models.Country countrym = new Models.Country(); countrym.CountryID = countryr.Id; countrym.CountryName = countryr.Name; //var ret = countries.Select(x => new { x.Id, x.Name }).ToList(); foreach (Country country in countries) { //if (country.Id == countryr.Id) //{ countrylist.Add(new Models.Country() { CountryID = country.Id, CountryName = country.Name, //Selected = true }); //} //else //{ //countrylist.Add(new Models.Country() //{ // CountryID = country.Id, // CountryName = country.Name, // Selected = false //}); //} } //countrylist.Insert(0, countrym); return(this.Json(countrylist, JsonRequestBehavior.AllowGet)); //return new JsonResult { Data = countrylist, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; }