public async Task <bool> updateNegotiationplan(GetNegotiationplanDto getNegotiationplanDto) { try { Negotiationplan oNegotiationplan = await _Negotiationplans.SingleAsync(i => i.id == getNegotiationplanDto.id); if (!oNegotiationplan.isAccepted && getNegotiationplanDto.isAccepted) { if (await _Negotiationplans.AnyAsync(i => i.negotiationId == getNegotiationplanDto.negotiationId && i.isAccepted == true)) { return(true); } } if (getNegotiationplanDto.isAccepted) { Negotiation ONegotiation = await _Negotiation.SingleAsync(i => i.id == getNegotiationplanDto.negotiationId); ONegotiation.state = NegotiationStates.ConfirmedbyCustomer; } oNegotiationplan.planName = getNegotiationplanDto.planName; oNegotiationplan.isAccepted = getNegotiationplanDto.isAccepted; oNegotiationplan.modiferUserId = getNegotiationplanDto.userId; await _uow.SaveChangesAsync(); return(true); } catch { return(false); } }
public async Task <HttpResponseMessage> updateNegotiationplan(GetNegotiationplanDto NegotiationplanDto) { NegotiationplanDto.userId = Setting.payloadDto.userId; if (await _NegotiationplanService.updateNegotiationplan(NegotiationplanDto)) { return(new HttpResponseMessage(HttpStatusCode.OK)); } else { return(new HttpResponseMessage(HttpStatusCode.NotModified)); } }
public async Task <HttpResponseMessage> insertNegotiationplan(GetNegotiationplanDto NegotiationplanDto) { NegotiationplanDto.userId = Setting.payloadDto.userId; if (await _NegotiationplanService.insertNegotiationplan(NegotiationplanDto)) { return(Request.CreateResponse(HttpStatusCode.Created)); } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError)); } }
public async Task <GetNegotiationplanDto> getNegotiationplan(int id) { GetNegotiationplanDto oNegotiationplanDto = await _NegotiationplanService.getNegotiationplan(new BaseDto { id = id, userId = Setting.payloadDto.userId }); if (oNegotiationplanDto == null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } else { return(oNegotiationplanDto); } }
public async Task <bool> insertNegotiationplan(GetNegotiationplanDto getNegotiationplanDto) { try { Negotiationplan oNegotiationplan = Mapper.Map <GetNegotiationplanDto, Negotiationplan>(getNegotiationplanDto); _Negotiationplans.Add(oNegotiationplan); await _uow.SaveChangesAsync(); return(true); } catch { return(false); } }