public void SpendPaddle() { var spendedPaddle = new SpendedPaddle { PaddleId = SelectedReceivedPaddle.PaddleId, AddedDate = SelectedReceivedPaddle.AddedDate, ActivityPerformed = SelectedReceivedPaddle.ActivityPerformed, RepairDate = RepairDate, Comments = SelectedReceivedPaddle.Comments, IsOrders = SelectedReceivedPaddle.IsOrders, DescriptionIntervention = DescriptionIntervention, ReceivingEmployee = SelectedReceivedPaddle.ReceivingEmployee, SpendingEmployee = String.Format("{0} {1}", EmployeeViewModel.SelectedEmployee.FirstName, EmployeeViewModel.SelectedEmployee.LastName) }; context.CreateSpendedPaddle(spendedPaddle); context.UpdateLastPreventionDate(SelectedReceivedPaddle); if (SelectedReceivedPaddle != null) { context.DeleteReceivedPaddle(SelectedReceivedPaddle); ReceivedPaddles.Remove(SelectedReceivedPaddle); SelectedReceivedPaddle = null; } ConnectedSuccessfully = true; }
public void Spend() { var spendedPaddle = new SpendedPaddle { PaddleId = SelectedReceivedPaddle.PaddleId, ReceivedDate = SelectedReceivedPaddle.ReceivedDate, ActivityPerformed = SelectedReceivedPaddle.ActivityPerformed, RepairDate = RepairDate, DescriptionIntervention = SelectedReceivedPaddle.DescriptionIntervention, ReceivingEmployee = SelectedReceivedPaddle.ReceivingEmployee, SpendingEmployee = String.Format("{0} {1}", EmployeeViewModel.SelectedEmployee.FirstName, EmployeeViewModel.SelectedEmployee.LastName) }; context.Spend(spendedPaddle); context.SetLastPreventionDate(SelectedReceivedPaddle); if (SelectedReceivedPaddle != null) { context.Remove(SelectedReceivedPaddle); ReceivedPaddles.Remove(SelectedReceivedPaddle); SelectedReceivedPaddle = null; } ConnectedSuccessfully = true; }