Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            WhatWeDo whatWeDo = db.WhatWeDos.Find(id);

            db.WhatWeDos.Remove(whatWeDo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public async Task <IActionResult> DeletePost(int?id)
        {
            WhatWeDo skill = await _context.WhatWeDos.FindAsync(id);

            _context.WhatWeDos.Remove(skill);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "Id,Title,Description,ImageURL")] WhatWeDo whatWeDo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(whatWeDo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(whatWeDo));
 }
Esempio n. 4
0
        public ActionResult Create([Bind(Include = "Id,Title,Description,ImageURL")] WhatWeDo whatWeDo)
        {
            if (ModelState.IsValid)
            {
                db.WhatWeDos.Add(whatWeDo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(whatWeDo));
        }
Esempio n. 5
0
        public async Task <IActionResult> Create(WhatWeDo skilll)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            await _context.WhatWeDos.AddAsync(skilll);

            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
            //return Content($"title-{skilll.Title} description-{skilll.Description}");
        }
Esempio n. 6
0
        public async Task <IActionResult> Create(WhatWeDo skill)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            await _context.WhatWeDos.AddAsync(skill);

            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Esempio n. 7
0
        public async Task <IActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            WhatWeDo skill = await _context.WhatWeDos.FindAsync(id);

            if (skill == null)
            {
                return(NotFound());
            }
            return(View(skill));
        }
Esempio n. 8
0
        public async Task <IActionResult> Create(WhatWeDo skill)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            await _dbPolo.WhatWeDos.AddAsync(skill);

            await _dbPolo.SaveChangesAsync();

            //return Content($"title {skill.Title}description {skill.Description}");
            return(RedirectToAction(nameof(Index)));
            //Bu yazilisda ModelBainting-de View mutleq model isteyir.
        }
Esempio n. 9
0
        // GET: Admin/WhatWeDoes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WhatWeDo whatWeDo = db.WhatWeDos.Find(id);

            if (whatWeDo == null)
            {
                return(HttpNotFound());
            }
            return(View(whatWeDo));
        }
Esempio n. 10
0
 public bool Delete(WhatWeDoDTO obj)
 {
     try
     {
         WhatWeDo data = _db.WhatWeDos.Find(obj.Id);
         _db.WhatWeDos.Remove(data);
         _db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 11
0
 public bool Update(WhatWeDoDTO obj, int Id)
 {
     try
     {
         WhatWeDo data = _db.WhatWeDos.Find(Id);
         data.Content    = obj.Content;
         data.LanguageId = obj.LanguageId;
         _db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 12
0
        public async Task <IActionResult> Update(int?id, WhatWeDo skill)
        {
            // WhatWeDo dbskill = await _dbPolo.WhatWeDos.FindAsync(id);
            if (!ModelState.IsValid)
            {
                return(View());
            }

            //dbskill.Title = skill.Title;
            //dbskill.Description = skill.Description;
            //await _dbPolo.SaveChangesAsync();
            _dbPolo.Entry(skill).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            await _dbPolo.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Esempio n. 13
0
 public WhatWeDoDTO Get(int Id)
 {
     try
     {
         WhatWeDo    data      = _db.WhatWeDos.Find(Id);
         WhatWeDoDTO finaldata = new WhatWeDoDTO
         {
             Id         = data.Id,
             Content    = data.Content,
             LanguageId = data.LanguageId
         };
         return(finaldata);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Esempio n. 14
0
        public IActionResult WhatWeDoDelete(int id)
        {
            bool datafound = _db.WhatWeDos.Any(t => t.Id == id);

            if (!datafound)
            {
                return(StatusCode(400, new ReturnErrorMessage((int)ErrorTypes.Errors.NotFound, message: "NotFound")));
            }
            WhatWeDo    data = _db.WhatWeDos.Find(id);
            WhatWeDoDTO dto  = new WhatWeDoDTO
            {
                Id         = id,
                Content    = data.Content,
                LanguageId = data.LanguageId
            };
            bool request = _wwd.Delete(dto);

            if (request)
            {
                return(Ok(new ReturnMessage(200, message: "Success")));
            }
            return(StatusCode(500, new ReturnErrorMessage((int)ErrorTypes.Errors.Internal, message: "Internal server error")));
        }