Exemplo n.º 1
0
        public bool CreateQuestionType(QuestionTypeEntities entity)
        {
            QuestionType newItem = new QuestionType()
            {
                IdQuesType   = entity.IdQuestionType,
                TypeName     = entity.TypeName,
                Status       = entity.Status,
                LastEditedAt = entity.LastEditedAt,
                LastEditedBy = entity.LastEditedBy
            };

            _unit.QuestionTypeGenericType.Insert(newItem);
            _unit.Save();
            return(true);
        }
Exemplo n.º 2
0
        public bool UpdateQuestionType(Guid id, QuestionTypeEntities entity)
        {
            bool success    = false;
            var  updateItem = _unit.QuestionTypeGenericType.GetByID(id);

            if (updateItem != null)
            {
                updateItem.TypeName     = entity.TypeName;
                updateItem.Status       = entity.Status;
                updateItem.LastEditedAt = entity.LastEditedAt;
                updateItem.LastEditedBy = entity.LastEditedBy;

                _unit.QuestionTypeGenericType.Update(updateItem);
                _unit.Save();
                success = true;
            }
            return(success);
        }
Exemplo n.º 3
0
        public JsonResult <APIResultEntities <bool> > Post(QuestionTypeEntities entity)
        {
            APIResultEntities <bool> rs = new APIResultEntities <bool>();

            try
            {
                _iQuestionTypeService.CreateQuestionType(entity);
                rs.Data           = true;
                rs.ErrCode        = ErrorCodeEntites.Success;
                rs.ErrDescription = string.Format(Constants.MSG_INSERT_SUCCESS, Constants.QuestionType);
            }
            catch (Exception ex)
            {
                rs.Data           = false;
                rs.ErrCode        = ErrorCodeEntites.Fail;
                rs.ErrDescription = ex.ToString();
            }
            return(Json(rs));
        }