Ejemplo n.º 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
         });
     }
 }