public async Task <bool> AddRepresentation(Representation representation)
        {
            using (var transaction = await _context.Database.BeginTransactionAsync().ConfigureAwait(false))
            {
                var result = true;
                try
                {
                    var record = new Model.Representation
                    {
                        Id           = representation.Id,
                        Created      = representation.Created,
                        LastModified = representation.LastModified,
                        ResourceType = representation.ResourceType,
                        Version      = representation.Version,
                        Attributes   = GetRepresentationAttributes(representation)
                    };
                    _context.Representations.Add(record);
                    await _context.SaveChangesAsync().ConfigureAwait(false);

                    transaction.Commit();
                }
                catch
                {
                    result = false;
                    transaction.Rollback();
                }

                return(result);
            }
        }
Ejemplo n.º 2
0
        public async Task <IScimResult> Delete(string id, string resourceSchema)
        {
            var user = await dbContext.Users.FindAsync(id);

            if (user != null)
            {
                dbContext.Users.Remove(user);
                await dbContext.SaveChangesAsync();
            }

            return(new ScimResult(ScimResultStatus.Success));
        }