public IActionResult ExamParameterAssign(ExamParameter examParameter) { var result = _examParameterService.AddOrUpdate(examParameter); if (result.Success) { return(RedirectToAction("Index", "ExamParameter")); } return(BadRequest()); }
public IResult AddOrUpdate(ExamParameter examParameter) { var list = _examParameterDal.GetList(); if (list.Any()) { list[0].LengthOfExam = examParameter.LengthOfExam; list[0].NumberOfQuestions = examParameter.NumberOfQuestions; _examParameterDal.Update(list[0]); return(new SuccessResult(Messages.UpdatedSuccess)); } examParameter.Id = "1"; _examParameterDal.Insert(examParameter); return(new SuccessResult(Messages.AddedSuccess)); }
public IResult Delete(ExamParameter examParameter) { _examParameterDal.Delete(examParameter); return(new SuccessResult(Messages.DeletedSuccess)); }