public testResultValueMemo ConvertModelToEntity(TestResultValueMemoModel model, int userId = -1)
        {
            testResultValueMemo entity = new testResultValueMemo();

            if (model == null)
            {
                return(null);
            }

            entity.appointmentTestId = model.AppointmentTestId;
            entity.value             = model.Value;
            entity.number            = model.Number;

            if (model.Id > 0)
            {
                entity.id = model.Id;
            }

            if (userId > 0)
            {
                if (entity.id > 0)
                {
                    entity.editedById   = userId;
                    entity.editedByDate = System.DateTime.Now;
                }
                else //entity.id <= 0
                {
                    entity.createdById   = userId;
                    entity.createdByDate = System.DateTime.Now;
                }
            }

            return(entity);
        }
        public TestResultValueMemoModel GetById(int id)
        {
            testResultValueMemo      entity = this._repository.GetById(id);
            TestResultValueMemoModel model  = this.ConvertEntityToModel(entity);

            return(model);
        }
        public TestResultValueMemoModel ConvertEntityToModel(testResultValueMemo entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var model = new TestResultValueMemoModel()
            {
                Id = entity.id,
                AppointmentTestId = entity.appointmentTestId,
                Value             = entity.value,
                Number            = entity.number
            };

            return(model);
        }
        public int Update(TestResultValueMemoModel model, int userId)
        {
            testResultValueMemo entity = this.ConvertModelToEntity(model, userId);

            return(this._repository.Update(entity));
        }