예제 #1
0
 public ActionResult Edit([Bind(Include = "Id,Title,SkilLevel")] Skils skils)
 {
     if (ModelState.IsValid)
     {
         db.Entry(skils).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(skils));
 }
예제 #2
0
        public ActionResult Create([Bind(Include = "Id,Title,SkilLevel")] Skils skils)
        {
            if (ModelState.IsValid)
            {
                db.Skils.Add(skils);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(skils));
        }
예제 #3
0
        // GET: Skils/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Skils skils = db.Skils.Find(id);

            if (skils == null)
            {
                return(HttpNotFound());
            }
            return(View(skils));
        }
예제 #4
0
        public Skils GetSkill(string id)
        {
            Skils skil = new Skils();

            try
            {
                skil = this.db.Skils.FirstOrDefault(x => x.Id == id);
            }
            catch (Exception e)
            {
                this.logService.AddLog(e.Message, LogTypes.Error.ToString());
            }
            return(skil);
        }
예제 #5
0
        // GET: Skils/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Skils skils = db.Skils.Find(id);

            if (skils == null)
            {
                return(HttpNotFound());
            }
            db.Skils.Remove(skils);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #6
0
        public bool DeleteSkill(string id)
        {
            bool operationOk = true;

            try
            {
                Skils skil = this.db.Skils.FirstOrDefault(x => x.Id == id);
                this.db.Skils.Remove(skil);
                this.db.SaveChanges();
            }
            catch (System.Exception e)
            {
                this.logService.AddLog(e.Message, LogTypes.Error.ToString());
                operationOk = false;
            }
            return(operationOk);
        }
예제 #7
0
        public bool AddSkill(Skils skill)
        {
            bool operationOk = true;

            try
            {
                this.db.Skils.Add(skill);
                this.db.SaveChanges();
            }
            catch (Exception e)
            {
                this.logService.AddLog(e.Message, LogTypes.Error.ToString());
                operationOk = false;
            }

            return(operationOk);
        }
예제 #8
0
        public bool EditSkill(Skils newSkill, string id)
        {
            bool operationOk = true;

            try
            {
                Skils oldSkil = this.db.Skils.FirstOrDefault(x => x.Id == id);
                oldSkil.Content = newSkill.Content;
                oldSkil.Image   = newSkill.Image;
                oldSkil.ImageId = newSkill.ImageId;
                oldSkil.Title   = newSkill.Title;
            }
            catch (System.Exception e)
            {
                this.logService.AddLog(e.Message, LogTypes.Error.ToString());
                operationOk = false;
            }
            return(operationOk);
        }