public NoteViewModel(OrderFulfillmentPropertyNote note) { if (note != null) { Added = note.Added; By = note.By.FirstName + " " + note.By.LastName; Email = note.By.Email; Note = note.Text; var clientRoles = RoleTypeExtensions.ClientRoles(); var noteCreatorRoles = note.By.Roles.Select(r => r.RoleType); IsClient = clientRoles.Any(e => noteCreatorRoles.Contains(e)); } }
public NoteViewModel AddNoteForProperty(int orderId, int propertyId, string note) { var order = _orderManager.GetOrderById(orderId); var property = order.ReconsiderationProperties.FirstOrDefault(e => e.Id == propertyId); if (property == null) { return new NoteViewModel(); } var noteResult = new OrderFulfillmentPropertyNote { Added = DateTime.Now, By = _securityContext.CurrentUser, Text = note }; property.Notes.Add(noteResult); _orderHistoryManager.AddNoteToReconsiderationProperty(orderId, property.Address); return new NoteViewModel(noteResult); }