public ActionResult Edit(int id, CareerModel careerModel) { try { var url = _iconfiguration.GetValue <string>("WebServices:Career:WebCareerService"); // TODO: Add update logic here WebCareerService.WebCareerServiceSoapClient soapClient = new WebCareerService.WebCareerServiceSoapClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress(url)); // TODO: Add insert logic here WebCareerService.CareerDto role = new WebCareerService.CareerDto() { CareerId = careerModel.CareerId, Deleted = careerModel.Deleted, Name = careerModel.Name, Faculty = new WebCareerService.FacultyDto() { FacultyId = careerModel.Faculty.FacultyId } }; soapClient.Update(role); return(RedirectToAction(nameof(Index))); } catch (System.Net.Http.HttpRequestException ex) { _logger.LogCritical(ex.Message); _logger.LogCritical(ex.StackTrace); return(View()); } catch (Exception ex) { _logger.LogCritical(ex.Message); _logger.LogCritical(ex.StackTrace); return(View()); } }
public async Task <CareerModel> Register(CareerModel career, ICollection <EducationDetails> educationDetails) { var user = new ApplicationUser { UserName = career.Email, Email = career.Email, DateOfBirth = career.DateOfBirth, Gender = career.Gender, Resume = career.Resume, Address = career.Address, Photo = career.Photo, PhoneNumber = career.Phone, FullName = career.FullName }; var result = await _um.CreateAsync(user, career.PassWord); foreach (var educationDetail in educationDetails) { educationDetail.User_id = user.Id; context.EducationDetails.Add(educationDetail); context.SaveChanges(); } if (result.Succeeded) { await _sm.SignInAsync(user, isPersistent : false); return(career); } else { return(null); } }
public async Task <IActionResult> EditProfile(CareerModel career, IFormFile fileUser, string Gender) { if (Gender == "male") { career.Gender = true; } else { career.Gender = false; } if (fileUser != null && fileUser.Length > 0) { string filePath = Path.Combine("wwwroot/images", fileUser.FileName); if (!System.IO.File.Exists(filePath)) { var stream = new FileStream(filePath, FileMode.Create); await fileUser.CopyToAsync(stream); } career.Photo = "images/" + fileUser.FileName; } var edit_carrer = await services.EditProfile(career); if (edit_carrer != null) { return(RedirectToAction("index", "Career")); } return(View()); }
public IHttpActionResult Update(CareerModel career) { u = credenciales.getUsuario(); c = credenciales.getUsuario(); var consulta = CareerData.Actualizar(career.CareerId, career.Clave, career.Nombre, career.InstitucionId, u); return(Ok(consulta)); }
public IHttpActionResult Create([FromBody] CareerModel career) { u = credenciales.getUsuario(); c = credenciales.getUsuario(); var consulta = CareerData.Crear(career.Clave, career.Nombre, career.InstitucionId, u); return(Ok(consulta)); }
// 'searchText' is what the user is searching for in a career public List <CareerModel> GetCareers(string searchText) { // Create a HTTP Request instance HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(_Url); // Indicate that this is a JSON request request.ContentType = "application/json"; // Indicate that this is a POST request request.Method = "POST"; // Add your API credentials to the Request Header request.Headers.Add("x-access-token: " + _AccessKey); // Add your search text to the request stream using (var streamWriter = new StreamWriter(request.GetRequestStream())) { streamWriter.Write("{\"query\":\"" + searchText + "\"}"); streamWriter.Flush(); streamWriter.Close(); } // Get the response from the server HttpWebResponse response = (HttpWebResponse)request.GetResponse(); string responseJSON = ""; if (response.StatusCode == HttpStatusCode.OK) { responseJSON = new StreamReader(response.GetResponseStream()).ReadToEnd(); } // Close the response response.Close(); // Parse the JSON response dynamic jsonObject = Newtonsoft.Json.JsonConvert.DeserializeObject(responseJSON); // Strongly-typed Model that will be returned from this function List <CareerModel> ret = new List <CareerModel>(); // Convert the weakly-typed JSON to a strongly-typed Model foreach (dynamic j in jsonObject.careers) { CareerModel career = new CareerModel(); career.position = j.position; career.cid = j.cid; career.label = j.label; career.isgreen = j.isgreen; career.imagename = j.imagename; career.desc = j.desc; ret.Add(career); } return(ret); }
public JobModel(DynamicContent sfContent) : base(sfContent) { if (sfContent != null) { Description = sfContent.GetStringSafe("Description"); Parent = new CareerModel(sfContent.SystemParentItem); } }
public ActionResult Career() { ViewData["AdditionHeader"] = "我的设置"; CareerModel model = new CareerModel(); model.CurUser = CurrentUser; model.CurUserConfig = CurrentUserConfig; model.Careers = Careers.GetCareersByUID(model.CurUser.ID); return(View(model)); }
public IHttpActionResult GetById(string universityId, int careerId) { CareerModel career = cData.GetById(careerId); if (career == null) { return(NotFound()); } return(Ok(career)); }
public void InsertOrUpdateCareer(CareerModel career) { if (database.Table <CareerModel>().Any(x => x.Id == career.Id)) { database.Update(career); } else { database.Insert(career); } }
public async Task <CareerModel> Login(CareerModel candidate) { var result = await _sm.PasswordSignInAsync(candidate.Email, candidate.PassWord, false, false); if (result.Succeeded) { return(candidate); } else { return(null); } }
public bool Update(CareerModel model, string userId) { var entity = _context.MstCareers.Find(model.Cd); entity.Name = model.Name.Trim(); entity.Code = model.Code.Trim(); entity.NameKana = model.NameKana.Trim(); entity.UpdateDate = DateTime.Now; entity.UpdateUserId = userId; Update(entity); return(true); }
// GET: Career/Edit/5 public ActionResult Edit(int id) { //ViewData["Edit"] = _localizer["Edit"]; //ViewData["Person"] = _localizer["Person"]; //ViewData["Save"] = _localizer["Save"]; //ViewData["BackToList"] = _localizer["BackToList"]; CareerController careerController = new CareerController(logger, _iconfiguration); WebCareerService.CareerDto caeerDto = null; try { ViewBag.ListCareer = new Microsoft.AspNetCore.Mvc.Rendering.SelectList( ( from career in careerController.CareerModel select new SelectListItem { Text = career.Name, Value = career.CareerId.ToString() } ) , "Value", "Text"); var url = _iconfiguration.GetValue <string>("WebServices:Career:WebCareerService"); WebCareerService.WebCareerServiceSoapClient soapClient = new WebCareerService.WebCareerServiceSoapClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress(url)); caeerDto = soapClient.GetId(id); } catch (System.Net.Http.HttpRequestException ex) { _logger.LogCritical(ex.Message); _logger.LogCritical(ex.StackTrace); } catch (Exception ex) { _logger.LogCritical(ex.Message); _logger.LogCritical(ex.StackTrace); } CareerModel careerModel = new CareerModel() { CareerId = caeerDto.CareerId, Deleted = caeerDto.Deleted, Name = caeerDto.Name, Faculty = new FacultyModel() { FacultyId = caeerDto.Faculty.FacultyId, Name = caeerDto.Faculty.Name, Deleted = caeerDto.Faculty.Deleted } }; return(View(careerModel)); }
protected void careersControl_OnAddChild(object sender, GenericEventArgs <Guid> e) { mainCareerControl.Visible = false; subCareerControl.Visible = true; var model = new CareerModel { ParentID = e.Value }; subCareerControl.Model = model; mpeAddEdit.Show(); }
private async void getCareerData() { progress.Show(); try { CareerModel response = await careerapi.GetCareerList(); List<ResDataCareer> resddat = response.res_data; Career = resddat[0].content_text; mWebView.Settings.JavaScriptEnabled = true; mWebView.SetWebViewClient(new MyWebViewClientCareer()); mWebView.LoadData("<html>" + Career + "</html>", "text/html", "utf-8"); // Toast.MakeText(this.Activity, "-->" + myFinalList[0].name,ToastLength.Short).Show(); // MyList.Adapter = new ArrayAdapter(Activity, Android.Resource.Layout.SimpleListItem1, aboutExamCoursename); progress.Dismiss(); if (Career.Length <= 0) { ISharedPreferences pref = Android.App.Application.Context.GetSharedPreferences("CareerInfo", FileCreationMode.Private); ISharedPreferencesEditor edit = pref.Edit(); edit.PutString("content_text", Career); edit.Apply(); } Intent intent = new Intent(Activity, typeof(Career_Fragment)); Activity.StartActivity(intent); } catch (Exception e) { } }
public bool Create(CareerModel model, string userId) { var entity = new MstCareer { Name = model.Name.Trim(), Code = model.Code.Trim(), NameKana = model.NameKana.Trim(), InsertDate = DateTime.Now, IsDeleted = false, InsertUserId = userId }; Add(entity); return(true); }
public IHttpActionResult Delete(int careerId) { CareerModel career = new CareerModel() { Id = careerId }; bool deleted = cData.Delete(career); if (!deleted) { return(BadRequest(Constants.MsgError)); } return(Ok(Constants.MsgSuccess)); }
public IHttpActionResult Create(string universityId, [FromBody] CareerModel career) { if (career == null) { return(BadRequest(Constants.MsgErrorArguments)); } career.UniversityCode = universityId; bool inserted = cData.Insert(career); if (!inserted) { return(BadRequest(Constants.MsgError)); } return(Ok(Constants.MsgSuccess)); }
public ActionResult CareerDetail(int?id) { CareerModel model; if (!Equals(id, null)) { var career = _service.GetCareerById(id.Value); var careerContent = career.career_content.Select(p => new CareerContentModel() { Id = p.career_content_id, Content = p.content, Title = p.title, }).ToList(); model = new CareerModel() { Id = career.career_id, ContentList = careerContent, City = career.city, CategoryId = career.category_id, Type = career.type, SalaryMin = career.salary_min, ExpiredDate = career.experied_date, Location = career.location }; } else { var careerContent = new List <CareerContentModel>(); for (int i = 0; i < 3; i++) { var content = new CareerContentModel() { Id = 0, Language = i }; careerContent.Add(content); } model = new CareerModel() { Id = 0, ContentList = careerContent }; } return(View(model)); }
public IHttpActionResult Update(string universityId, int careerId, [FromBody] CareerModel career) { if (career == null) { return(BadRequest(Constants.MsgErrorArguments)); } career.UniversityCode = universityId; career.Id = careerId; bool updated = cData.Update(career); if (!updated) { return(BadRequest(Constants.MsgError)); } return(Ok(Constants.MsgSuccess)); }
/* * public async Task<CareerModel> Register(CareerModel model, ICollection<EducationCareer> educationCareers) * { * * var user = new ApplicationUser * { * UserName = model.Email, * Email = model.Email, * DateOfBirth=model.DateOfBirth, * Gender=model.Gender, * Resume=model.Resume, * Address=model.Address, * Photo=model.Photo, * PhoneNumber=model.Phone, * FullName=model.FullName * }; * var result = await _um.CreateAsync(user, model.PassWord); * int order = 1; * foreach (var educationCareer in educationCareers) * { * var findEducation = context.Educations.FirstOrDefault(e => e.Name_school.ToLower().Equals(educationCareer.Education.Name_school.ToLower()) * && e.Location.ToLower().Equals(educationCareer.Education.Location.ToLower())); * if (findEducation == null) * { * var new_education = new Education * { * Name_school = educationCareer.Education.Name_school, * Location = educationCareer.Education.Location * }; * context.Educations.Add(new_education); * // context.SaveChanges(); * educationCareer.Education_Id = new_education.Id; * } * else * { * educationCareer.Education_Id = findEducation.Id; * } * educationCareer.Order = order; * order++; * educationCareer.User_Id = user.Id; * context.EducationCareers.Add(educationCareer); * context.SaveChanges(); * } * * * if (result.Succeeded) * { * * await _sm.SignInAsync(user, isPersistent: false); * return model; * } * else * { * return null; * } * * * * * }*/ public async Task <CareerModel> EditResume(CareerModel career) { var user = await _um.FindByIdAsync(career.Id); user.Resume = career.Resume; var result = await _um.UpdateAsync(user); if (result.Succeeded) { return(career); } else { return(null); } }
public async Task <IActionResult> Login(CareerModel candidate) { var model = await services.Login(candidate); if (model != null) { ViewBag.Msg = "success"; return(RedirectToAction("index", "Home")); } else { ViewBag.Msg = "invalid"; } return(View()); }
public ActionResult CareerDetail(CareerModel model) { using (var scope = new TransactionScope()) { var career = _service.GetCareerById(model.Id); if (Equals(career, null)) { career = new career() { career_id = 0, created_date = ConvertDatetime.GetCurrentUnixTimeStamp() }; } career.type = model.Type; career.city = model.City; career.category_id = model.CategoryId; career.salary_min = model.SalaryMin; career.location = model.Location; career.experied_date = model.ExpiredDate; _service.SaveCareer(career); int idx = 0; foreach (var careerContent in model.ContentList) { var content = _service.GetCareerContentById(careerContent.Id); if (Equals(content, null)) { content = new career_content() { career_content_id = 0, career_id = career.career_id, language = idx }; } content.title = careerContent.Title; content.content = careerContent.Content; _service.SaveCareerContent(content); idx++; } scope.Complete(); } return(RedirectToAction("Career")); }
public async Task <CareerModel> Register(CareerModel model, Education newEducation) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email, DateOfBirth = model.DateOfBirth, Gender = model.Gender, Resume = model.Resume, Address = model.Address, Photo = model.Photo, PhoneNumber = model.Phone }; var educationCarrer = new EducationCareer(); var education = context.Educations.SingleOrDefault(e => e.Name_school.ToLower().Equals(newEducation.Name_school.ToLower())); if (education == null) { context.Educations.Add(newEducation); context.SaveChanges(); educationCarrer.Education_Id = newEducation.Id; } else { educationCarrer.Education_Id = education.Id; } var result = await _um.CreateAsync(user, model.PassWord); educationCarrer.User_Id = user.Id; context.EducationCareers.Add(educationCarrer); context.SaveChanges(); if (result.Succeeded) { await _sm.SignInAsync(user, isPersistent : false); return(model); } else { return(null); } }
public async Task <ActionResult> Details(int id) { var CareerModel = new CareerModel(); var careerForm = new CareerFormModel(); var general = url + "Careers/GetCareerById?careerId=" + id; var responseMessage = await _client.GetAsync(general); if (!responseMessage.IsSuccessStatusCode) { return(View(CareerModel)); } var responseData = responseMessage.Content.ReadAsStringAsync().Result; CareerModel = JsonConvert.DeserializeObject <CareerModel>(responseData); careerForm.CareerId = CareerModel.CareerId; ViewBag.Title = CareerModel.Title; return(RedirectToAction("Upload", careerForm)); //return View(careerForm); }
public async Task <CareerModel> Register(CareerModel model) { var user = new IdentityUser { UserName = model.Email, Email = model.Email, }; var result = await _um.CreateAsync(user, model.PassWord); if (result.Succeeded) { await _sm.SignInAsync(user, isPersistent : false); return(model); } return(null); }
public async Task <IActionResult> Register(CareerModel candidate) { try { var result = await services.Register(candidate); if (result != null) { return(RedirectToAction("index", "Home")); } else { } } catch (Exception e) { ModelState.AddModelError(string.Empty, e.Message); } return(View()); }
public async Task <CareerModel> EditProfile(CareerModel career) { var user = await _um.FindByIdAsync(career.Id); user.Address = career.Address; user.DateOfBirth = career.DateOfBirth; user.Gender = career.Gender; user.PhoneNumber = career.Phone; user.Photo = career.Photo; user.FullName = career.FullName; var result = await _um.UpdateAsync(user); if (result.Succeeded) { return(career); } else { return(null); } }
public async Task <IActionResult> Register(CareerModel candidate, IFormFile file, Education newEducation, IFormFile fileUser) { try { if (fileUser.Length > 0) { var filePath = Path.Combine("wwwroot/images", fileUser.FileName); var stream = new FileStream(filePath, FileMode.Create); await file.CopyToAsync(stream); candidate.Photo = "/images/" + fileUser.FileName; } if (file.Length > 0) { var filePath = Path.Combine("wwwroot/file", file.FileName); var stream = new FileStream(filePath, FileMode.Create); await file.CopyToAsync(stream); candidate.Resume = "/file/" + file.FileName; } var result = await services.Register(candidate, newEducation); if (result != null) { return(RedirectToAction("index", "Career")); } else { } } catch (Exception e) { ModelState.AddModelError(string.Empty, e.Message); } return(View()); }
// GET: Career/Details/5 public ActionResult Details(int id) { //ViewData["Person"] = _localizer["Person"]; //ViewData["Edit"] = _localizer["Edit"]; //ViewData["Details"] = _localizer["Details"]; //ViewData["BackToList"] = _localizer["BackToList"]; WebCareerService.CareerDto careerDto = null; try { var url = _iconfiguration.GetValue <string>("WebServices:Career:WebCareerService"); WebCareerService.WebCareerServiceSoapClient soapClient = new WebCareerService.WebCareerServiceSoapClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress(url)); careerDto = soapClient.GetId(id); } catch (System.Net.Http.HttpRequestException ex) { _logger.LogCritical(ex.Message); _logger.LogCritical(ex.StackTrace); } catch (Exception ex) { _logger.LogCritical(ex.Message); _logger.LogCritical(ex.StackTrace); } CareerModel careerModel = new CareerModel() { CareerId = careerDto.CareerId, Deleted = careerDto.Deleted, Name = careerDto.Name, Faculty = new FacultyModel() { FacultyId = careerDto.Faculty.FacultyId, Name = careerDto.Faculty.Name, Deleted = careerDto.Faculty.Deleted } }; return(View(careerModel)); }