public async Task <ActionResult> Edit(technology technology, HttpPostedFileBase file) { AccountController oAccountController = new AccountController(); if (!oAccountController.isSlugExist(technology.slugURL, "technologies", technology.technologyID, 0)) { ViewBag.result1 = "EXISTS"; return(View(technology)); } if (file != null) { technology.seo_OGImage = UploadFile(file, "/Content/marketing"); } technology.createdDate = BaseUtil.GetCurrentDateTime(); if (ModelState.IsValid) { db.Entry(technology).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(technology)); }
public async Task <ActionResult> Create(technology technology, HttpPostedFileBase file) { AccountController oAccountController = new AccountController(); if (!oAccountController.isSlugExist(technology.slugURL, "technologies", technology.technologyID, 0)) { ViewBag.result1 = "EXISTS"; return(View(technology)); } ViewBag.result = "f"; if (file != null) { technology.seo_OGImage = UploadFile(file, "/Content/marketing"); } technology.createdDate = BaseUtil.GetCurrentDateTime(); if (ModelState.IsValid) { db.technologies.Add(technology); await db.SaveChangesAsync(); ViewBag.result = "f"; return(View()); } return(View(technology)); }
public ActionResult DeleteConfirmed(int id) { technology technology = db.technologies.Find(id); db.technologies.Remove(technology); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "TechnologyId,Title,Description,Image,PubDate")] technology technology) { if (ModelState.IsValid) { db.Entry(technology).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(technology)); }
public Player(Color ownColor, technology ownTech) { pColor = ownColor; pTech = ownTech; for (int i = 0; i < 4; i++) { pDiploAtk.Add(0); pDiploDef.Add(0); } }
public ActionResult Create([Bind(Include = "TechnologyId,Title,Description,Image,PubDate")] technology technology) { if (ModelState.IsValid) { db.technologies.Add(technology); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(technology)); }
public ActionResult Edit([Bind(Include = "technology_id,competence_id,name,rank,core")] technology technology) { if (ModelState.IsValid) { db.Entry(technology).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.competence_id = new SelectList(db.competence, "competence_id", "name", technology.competence_id); return(View(technology)); }
// GET: /technology/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } technology technology = db.technologies.Find(id); if (technology == null) { return(HttpNotFound()); } return(View(technology)); }
public async Task <ActionResult> Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } technology technology = await db.technologies.FindAsync(id); if (technology == null) { return(HttpNotFound()); } return(View(technology)); }
public List <technology> GetAllTechnologies() { List <technology> TList = new List <technology>(); var technologylist = (from t in db.technology select new { t.name }).ToList(); foreach (var t in technologylist) { technology item = new technology(); item.name = t.name; TList.Add(item); } return(TList); }
// GET: technologies/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } technology technology = db.technology.Find(id); if (technology == null) { return(HttpNotFound()); } ViewBag.competence_id = new SelectList(db.competence, "competence_id", "name", technology.competence_id); return(View(technology)); }
public List <technology> GetTechnologiesByCompetenceId(int?id) { List <technology> techList = new List <technology>(); var tList = (from t in db.technology where t.competence_id == id select new { t.name, t.competence_id }).ToList(); foreach (var technology in tList) { technology item = new technology(); item.name = technology.name; techList.Add(item); } return(techList); }
public void GetTechnologyList(FullResume fullResume) //Metod för att hämta teknologier med inskickad ResumeVM och lagra dessa i en lista { fullResume.Technologies.Clear(); foreach (competence competence in fullResume.MyCompetences) { string sql = "SELECT name, technology_id FROM technology WHERE competence_id = @competenceID"; technology t; try { using (SqlConnection conn = new SqlConnection(GetBuilder().ConnectionString)) { conn.Open(); using (SqlCommand command = new SqlCommand(sql, conn)) { command.Parameters.AddWithValue("competenceID", competence.competence_id); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { t = new technology() { name = (reader.GetString(0)), technology_id = (reader.GetInt32(1)) }; fullResume.Technologies.Add(t); } } } } } catch (Exception) { // gör något med felmeddelandet throw; } } }