//public TeacherDisciplineStatusProcessor(ITeacherDisciplineStatusDao dao, // ITeacherDisciplineStatusParamConverter paramConverter, // ITeacherDisciplineStatusResultConverter resultConverter) //{ // this.Dao = dao; // this.ParamConverter = paramConverter; // this.ResultConverter = resultConverter; //} public TeacherDisciplineStatusResult Create(TeacherDisciplineStatusParam param) { Model.TeacherDisciplineStatus entity = ParamConverter.Convert(param, null); entity = Dao.Save(entity); return(ResultConverter.Convert(entity)); }
public void Update(long id, TeacherDisciplineStatusParam param) { Model.TeacherDisciplineStatus oldEntity = Dao.Find(id); if (oldEntity != null) { Dao.Delete(oldEntity); Dao.Update(ParamConverter.Convert(param, null)); } else { Console.WriteLine($"No entity with Id = {id} was found"); } }
//public TeacherDisciplineStatusService(ITeacherDisciplineStatusProcessor processor) //{ // this.Processor = processor; //} /// <summary> /// Function to create new a entity . /// </summary> /// <param name="param">a entity</param> /// <returns>response and new entity</returns> public ApiResponse Create(TeacherDisciplineStatusParam param) { ApiResponse response = new ApiResponse(); try { response.Text = $"The entity successfully added .\n" + $" {Serialization.Serizlize(Processor.Create(param))}"; response.Result = true; return(response); } catch (Exception ex) { response.Result = false; response.Text = ex.Message; return(response); } }
/// <summary> /// Function to update information about a entity . /// </summary> /// <param name="id">entity's id</param> /// <param name="param">entity</param> /// <returns>response and update entity</returns> public ApiResponse Update(long id, TeacherDisciplineStatusParam param) { ApiResponse response = new ApiResponse(); try { Processor.Update(id, param); response.Text = "The entity updated successfully . \n"; response.Result = true; return(response); } catch (Exception ex) { response.Result = false; response.Text = ex.Message; return(response); } }
public Model.TeacherDisciplineStatus Convert(TeacherDisciplineStatusParam param, Model.TeacherDisciplineStatus oldEntity) { Model.TeacherDisciplineStatus entity = null; if (oldEntity != null) { entity = oldEntity; } else { entity = new Model.TeacherDisciplineStatus() { Code = param.Code, Id = param.Id, Description = param.Description, Name = param.Name }; } return(entity); }
/// <summary> /// /// </summary> /// <param name="param">a entity</param> public void ValidateParameters(TeacherDisciplineStatusParam param) { throw new NotImplementedException(); }