I am not using a controller or method for my page. I am also using the ABP supplied modal. I only customized the JS file.
In your EF project, there is a class named MyProjectDbContext.cs, you will find the code shown below. Each time you add new entities, you need to add one line of code as shown.
public class MyProjectNameDbContext : AbpZeroDbContext<Tenant, Role, User>
{
/* Define an IDbSet for each entity of the application */
public virtual IDbSet<BinaryObject> BinaryObjects { get; set; }
public virtual IDbSet<Friendship> Friendships { get; set; }
public virtual IDbSet<ChatMessage> ChatMessages { get; set; }
//20161103 - Added for My Proj
public virtual IDbSet<MyEntity> MyTable { get; set; }
To get the custom seed classes to run you need to update the method, shown below, in EF project. This method is in the Configuration.cs class in the "migrations" folder.
protected override void Seed(EntityFramework.MyProjectDbContext context)
{
///Code removed for simplicity
//You add this line:
new AddressRelated(context).Create();
}
AddressRelated is my seed data class, where I load tables like Country and State.
You are showing me C# code.
I need it available in the ChangePictureModal.js file, where I make the app service call.
Thanks! I have this working, almost, I have one issue.
On my person Index view, from my JTable action column I call the existing ABP supplied ChangePictureModal.
var _changePictureModal = new app.ModalManager({
viewUrl: abp.appPath + 'Mpa/Profile/ChangePictureModal',
scriptUrl: abp.appPath + 'Areas/Mpa/Views/Person/_ChangePictureModal.js',
modalClass: 'ChangeProfilePictureModal'
});
if (_permissions.edit) {
$('<button class="btn btn-default btn-xs" title="' + app.localize('Add photo') + '"><i class="fa fa-camera"></i></button>')
.appendTo($span)
.click(function () {
_changePictureModal.open({ id: data.record.id });
});
}
I need to pass my Person "Id" key value to this modal. So as you can see, I am trying to pass it via the open() call.
How do I read this value in the ChangePictureModal.js file?
I have created a copy of this JS file in the view folder for my Person entity. I have changed the app service method so that I can update my Person record with the new pictureId.
I have a requirement in my application to store images for a "person" entity. I noticed in the ABP tables, you have below table defined.
{
[Table("AppBinaryObjects")]
public class BinaryObject : Entity<Guid>, IMayHaveTenant
{
public virtual int? TenantId { get; set; }
[Required]
public virtual byte[] Bytes { get; set; }
public BinaryObject()
{
Id = Guid.NewGuid();
}
public BinaryObject(int? tenantId, byte[] bytes)
: this()
{
TenantId = tenantId;
Bytes = bytes;
}
}
This table is used to store user profile images.
Questions:
Thanks very much, that did it!
Have you had a chance to look into this issue?
I have emailed you a link to the latest version of solution code and mentioned one more issue in my email.
Please ignore this post.
My home record had a null value in the NoteID column and that is why note entity was not loading. :shock:
I have this method, below, for getting one single entity:
public async Task<EditNurseHomeDto> GetHomeForEdit(NullableIdDto input)
{
var nurseHomeEdit = (await _homeRepository.GetAsync((int)input.Id));
var nh = nurseHomeEdit.MapTo<EditNurseHomeDto>();
return nh;
}
I have used this exact same method for another entity. In that other entity when the above method executes, it brings the data for the related entity (notes). However in the above method it is not bringing the related entity (Notes) back. The DTOs are structured virtually the same for both entities, yet it does not work in the above method?