示例#1
0
 public DataModel.Response.InsertResponse Create(DataModel.Model.ExperienceModel experience)
 {
     try
     {
         IExperienceRepository experienceRepository = RepositoryClassFactory.GetInstance().GetExperienceRepository();
         IList <Experience>    _experiences         = experienceRepository.FindByOrganization(experience.Organization);
         if (_experiences != null && _experiences.Count > 0)
         {
             return(new InsertResponse
             {
                 ErrorCode = (int)ErrorCode.Error,
                 Message = string.Format(Resources.Resource.msg_insert_exists, "Organization", experience.Organization)
             });
         }
         var    _experience = MapperUtil.CreateMapper().Mapper.Map <ExperienceModel, Experience>(experience);
         object id          = experienceRepository.Insert(_experience);
         return(new InsertResponse
         {
             InsertID = id.ToString(),
             ErrorCode = (int)ErrorCode.None,
             Message = Resources.Resource.msg_create_success
         });
     }
     catch (Exception ex)
     {
         return(new InsertResponse
         {
             ErrorCode = (int)ErrorCode.Error,
             Message = ex.Message
         });
     }
 }
示例#2
0
 public DataModel.Response.BaseResponse Update(DataModel.Model.ExperienceModel experience)
 {
     try
     {
         IExperienceRepository experienceRepository = RepositoryClassFactory.GetInstance().GetExperienceRepository();
         var _experience = MapperUtil.CreateMapper().Mapper.Map <ExperienceModel, Experience>(experience);
         experienceRepository.Update(_experience);
         return(new BaseResponse
         {
             ErrorCode = (int)ErrorCode.None,
             Message = Resources.Resource.msg_update_success
         });
     }
     catch (Exception ex)
     {
         return(new BaseResponse
         {
             ErrorCode = (int)ErrorCode.Error,
             Message = ex.Message
         });
     }
 }