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); }
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); }
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)); }