public HttpResponseMessage allowdToPrint(Job job) { UserDTO user = UserLogic.Login(new UserDTO() { userTz = job.userTz }); double?AmountToPay, balance; if (user != null) { balance = UserLogic.getBalanceByUser(user); AmountToPay = JobLogic.CalaulateJob(job); if (AmountToPay - balance >= 0) { PrintHistoryLogic.AddPrint(new PrintHistoryDTO() { userId = user.userId, datePrint = DateTime.Now, costPrint = AmountToPay, isColorFull = job.isColorFull, sumOfPages = job.numOfPages, printerName = job.printerName }); return(Request.CreateResponse(HttpStatusCode.OK, "OK")); } return(Request.CreateResponse(HttpStatusCode.BadRequest, "Small_balance")); } return(Request.CreateResponse(HttpStatusCode.BadRequest, "User_doesnt_exist")); }
public HttpResponseMessage AddPrinting(PrintHistoryDTO print) { PrintHistoryLogic.AddPrint(print); return(Request.CreateResponse(HttpStatusCode.OK)); }