Epiworx.Data.EntityFramework.AttachmentDataFactory.Update C# (CSharp) Method

Update() public method

public Update ( AttachmentData data ) : AttachmentData
data AttachmentData
return AttachmentData
        public AttachmentData Update(AttachmentData data)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                         .GetManager(Database.ApplicationConnection, false))
            {
                var attachment =
                    new Attachment
                    {
                        AttachmentId = data.AttachmentId
                    };

                ctx.ObjectContext.Attachments.Attach(attachment);

                DataMapper.Map(data, attachment);

                ctx.ObjectContext.SaveChanges();

                return data;
            }
        }