public string Post(LU_Commnets _LU_Commnets, string transactionType)
        {
            string ret = string.Empty;

            try
            {
                Parameters[] colparameters = new Parameters[9] {
                    new Parameters("@paramId", _LU_Commnets.Id, DbType.Int32, ParameterDirection.Input),
                    new Parameters("@paramCommentsTypeId", _LU_Commnets.CommentsTypeId, DbType.Int32, ParameterDirection.Input),
                    new Parameters("@paramComments", _LU_Commnets.Comments, DbType.String, ParameterDirection.Input),
                    new Parameters("@paramCreatorId", _LU_Commnets.CreatorId, DbType.Int32, ParameterDirection.Input),
                    new Parameters("@paramCreationDate", _LU_Commnets.CreationDate, DbType.DateTime, ParameterDirection.Input),
                    new Parameters("@paramModifierId", _LU_Commnets.ModifierId, DbType.Int32, ParameterDirection.Input),
                    new Parameters("@paramModificationDate", _LU_Commnets.ModificationDate, DbType.DateTime, ParameterDirection.Input),
                    new Parameters("@paramIsActive", _LU_Commnets.IsActive, DbType.Boolean, ParameterDirection.Input),
                    new Parameters("@paramTransactionType", transactionType, DbType.String, ParameterDirection.Input)
                };
                dbExecutor.ManageTransaction(TransactionType.Open);
                ret = dbExecutor.ExecuteScalarString(true, CommandType.StoredProcedure, "wsp_LU_Commnets_Post", colparameters, true);
                dbExecutor.ManageTransaction(TransactionType.Commit);
            }
            catch (DBConcurrencyException except)
            {
                dbExecutor.ManageTransaction(TransactionType.Rollback);
                throw except;
            }
            catch (Exception ex)
            {
                dbExecutor.ManageTransaction(TransactionType.Rollback);
                throw ex;
            }
            return(ret);
        }
Example #2
0
        public IHttpActionResult PutLU_Commnets(int id, LU_Commnets lU_Commnets)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != lU_Commnets.Id)
            {
                return(BadRequest());
            }

            db.Entry(lU_Commnets).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LU_CommnetsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #3
0
        public IHttpActionResult GetLU_Commnets(int id)
        {
            LU_Commnets lU_Commnets = db.LU_Commnets.Find(id);

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

            return(Ok(lU_Commnets));
        }
Example #4
0
        public IHttpActionResult PostLU_Commnets(LU_Commnets lU_Commnets)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LU_Commnets.Add(lU_Commnets);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = lU_Commnets.Id }, lU_Commnets));
        }
Example #5
0
        public IHttpActionResult DeleteLU_Commnets(int id)
        {
            LU_Commnets lU_Commnets = db.LU_Commnets.Find(id);

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

            db.LU_Commnets.Remove(lU_Commnets);
            db.SaveChanges();

            return(Ok(lU_Commnets));
        }
Example #6
0
        public string Post(LU_Commnets obj, string transactionType)
        {
            string ret = string.Empty;

            try
            {
                obj.CreatorId        = 1;
                obj.ModifierId       = 1;
                obj.CreationDate     = DateTime.Now;
                obj.ModificationDate = DateTime.Now;
                ret = Facade.LU_CommnetsDAO.Post(obj, transactionType);
                return(ret);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }