Exemplo n.º 1
0
        //public LectureStatusProcessor(ILectureStatusDao dao, ILectureStatusParamConverter paramConverter,
        //   ILectureStatusResultConverter resultConverter)
        //{
        //    this.Dao = dao;
        //    this.ParamConverter = paramConverter;
        //    this.ResultConverter = resultConverter;
        //}

        public LectureStatusResult Create(LectureStatusParam param)
        {
            Model.LectureStatus entity = ParamConverter.Convert(param, null);

            entity = Dao.Save(entity);

            return(ResultConverter.Convert(entity));
        }
Exemplo n.º 2
0
        /// <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, LectureStatusParam 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);
            }
        }
Exemplo n.º 3
0
        //public LectureStatusService(ILectureStatusProcessor 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(LectureStatusParam 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);
            }
        }
        public Model.LectureStatus Convert(LectureStatusParam param,
                                           Model.LectureStatus oldEntity)
        {
            Model.LectureStatus entity = null;

            if (oldEntity != null)
            {
                entity = oldEntity;
            }
            else
            {
                entity = new Model.LectureStatus
                {
                    Code        = param.Code,
                    Id          = param.Id,
                    Description = param.Description,
                    Name        = param.Name
                };
            }

            return(entity);
        }
Exemplo n.º 5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="param">a entity</param>
 public void ValidateParameters(LectureStatusParam param)
 {
     throw new NotImplementedException();
 }