public PrivateMessageVM SetPMProperties(PrivateMessageVM privateMessageVM, string userid) { var userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(db)); privateMessageVM.PM.receiverId = userManager.FindByName(privateMessageVM.UserName).Id; privateMessageVM.PM.senderId = userManager.FindById(userid).Id; return privateMessageVM; }
public void SaveNewMessageToDatabase(PrivateMessageVM privateMessageVM) { db.message.Add(privateMessageVM.PM); db.SaveChanges(); }