Beispiel #1
0
        public ActionResult Create([Bind(Include = "id,title,image,des,fullcontent,datetime,keywords,cat")] news news)
        {
            if (Config.getCookie("logged") == "")
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (ModelState.IsValid)
            {
                news.datetime = DateTime.Now;
                db.news.Add(news);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(news));
        }
Beispiel #2
0
        // PUT: api/InfoScore/5
        public void Put(int id, [FromBody] InfoScore value)
        {
            InfoScore change = bd.InfoScore.Find(id);

            change.launchNF  = value.launchNF;
            change.openDebt  = value.openDebt;
            change.valueDebt = value.valueDebt;
            change.scoreComp = value.scoreComp;
            bd.SaveChanges();
        }
Beispiel #3
0
        // PUT: api/Company/5
        public string Put(int id, [FromBody] InfoScore value)
        {
            InfoScore change = bd.InfoScore.Find(id);

            change.launchNF  = value.launchNF;
            change.openDebt  = value.openDebt;
            change.valueDebt = value.valueDebt;
            change.scoreComp = value.scoreComp;
            bd.SaveChanges();
            return("Alterado com sucesso!!");
        }
 public int DeleteUserById(int id)
 {
     using (var db = new companyEntities())
     {
         tblUser user = _mapper.Map <tblUser>(GetUserById(id));
         if (user != null)
         {
             db.Entry(user).State = EntityState.Deleted;
             db.SaveChanges();
             return(1);
         }
         return(0);
     }
 }
        public int AddUser(UserDTO user)
        {
            if (user != null)
            {
                using (var db = new companyEntities())
                {
                    db.tblUsers.Add(_mapper.Map <tblUser>(user));
                    db.SaveChanges();
                    return(user.id);
                }
            }

            return(0);
        }
        public int AddProd(GoodDTO prod)
        {
            if (prod != null)
            {
                using (var db = new companyEntities())
                {
                    db.tblGoods.Add(_mapper.Map <tblGood>(prod));
                    db.SaveChanges();
                    return(prod.id);
                }
            }

            return(0);
        }