Пример #1
0
        public IHttpActionResult PutWorkitemMT(TB_Workitem workitem)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                TB_Workitem objWork = new TB_Workitem();
                objWork = objEntity.TB_Workitem.Find(workitem.ID);
                if (objWork != null)
                {
                    objWork.ID          = workitem.ID;
                    objWork.Tipo        = workitem.Tipo;
                    objWork.Titulo      = workitem.Titulo;
                    objWork.DataCriacao = workitem.DataCriacao;
                }

                int i = this.objEntity.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }

            return(Ok(workitem));
        }
Пример #2
0
        public IHttpActionResult DeleteWorkitemDL(int id)
        {
            TB_Workitem workitem = objEntity.TB_Workitem.Find(id);

            if (workitem == null)
            {
                return(NotFound());
            }

            objEntity.TB_Workitem.Remove(workitem);
            objEntity.SaveChanges();

            return(Ok(workitem));
        }
Пример #3
0
        public IHttpActionResult PostWorkitem(TB_Workitem data)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                objEntity.TB_Workitem.Add(data);
                objEntity.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }

            return(Ok(data));
        }
Пример #4
0
        public IHttpActionResult GetWorkitemId(string workitemId)
        {
            TB_Workitem objWork = new TB_Workitem();
            int         ID      = Convert.ToInt32(workitemId);

            try
            {
                objWork = objEntity.TB_Workitem.Find(ID);
                if (objWork == null)
                {
                    return(NotFound());
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(Ok(objWork));
        }