Example #1
0
        public IdentityPropertyDto GetIdentityProperty(int?id)
        {
            IdentityPropertyDto identityPropertyDto = new IdentityPropertyDto();

            if (!id.HasValue && id.GetValueOrDefault() <= 0)
            {
                return(identityPropertyDto);
            }
            IdentityProperty identityProperty = this.Session.Get <IdentityProperty>(id.Value);

            if (identityProperty == null)
            {
                return(identityPropertyDto);
            }
            return(identityProperty.ToModel());
        }
Example #2
0
        public void AddIdentityProperty(IdentityPropertyDto identityPropertyDto)
        {
            var transaction = this.Session.BeginTransaction();

            try
            {
                var identityProperty = identityPropertyDto.ToEntity();
                this.Session.Save(identityProperty);

                transaction.Commit();
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                throw ex;
            }
        }
Example #3
0
        public void UpdateIdentityProperty(int id, IdentityPropertyDto identityPropertyDto)
        {
            var transaction = this.Session.BeginTransaction();

            try
            {
                IdentityProperty identityProperty = this.Session.Get <IdentityProperty>(id);
                identityProperty = identityPropertyDto.ToEntity(identityProperty);
                this.Session.Update(identityProperty);

                transaction.Commit();
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                throw ex;
            }
        }
        public IActionResult GetIdentityProperty(int?id)
        {
            IdentityPropertyDto data = this.service.GetIdentityProperty(id);

            return(Success(data));
        }
 public IActionResult UpdateIdentityProperty(int id, [FromBody] IdentityPropertyDto IdentityResourcePropertyDto)
 {
     this.service.UpdateIdentityProperty(id, IdentityResourcePropertyDto);
     return(Success());
 }
 public IActionResult AddIdentityProperty([FromBody] IdentityPropertyDto identityResourcePropertyDto)
 {
     this.service.AddIdentityProperty(identityResourcePropertyDto);
     return(Success());
 }
 public static IdentityProperty ToEntity(this IdentityPropertyDto identityResourcePropertyDto, IdentityProperty identityResourceProperty = null)
 {
     return(Mapper.Map <IdentityPropertyDto, IdentityProperty>(identityResourcePropertyDto, identityResourceProperty));
 }