public static async Task ClearLinkAsync(ossContext context, string sid, UgyfelDto dto) { SessionBll.Check(context, sid); await CsoportDal.JogeAsync(context, JogKod.UGYFELEKMOD); await UgyfelDal.Lock(context, dto.Ugyfelkod, dto.Modositva); var entity = await UgyfelDal.GetAsync(context, dto.Ugyfelkod); entity.Kikuldesikod = null; entity.Kikuldesikodidopontja = null; await UgyfelDal.UpdateAsync(context, entity); }
public UgyfelDto CreateUgyfel(UgyfelDto ugyfelDto) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var ugyfel = Mapper.Map <UgyfelDto, Ugyfel>(ugyfelDto); _context.Ugyfelek.Add(ugyfel); _context.SaveChanges(); ugyfelDto.Id = ugyfel.Id; return(ugyfelDto); }
public void UpdateUgyfel(int id, UgyfelDto ugyfelDto) { if (!ModelState.IsValid) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var ugyfelInDb = _context.Ugyfelek.SingleOrDefault(u => u.Id == id); if (ugyfelDto == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } Mapper.Map(ugyfelDto, ugyfelInDb); _context.SaveChanges(); }
public async Task <StringResult> GetLink([FromQuery] string sid, [FromBody] UgyfelDto dto) { var result = new StringResult(); using (var tr = await _context.Database.BeginTransactionAsync()) try { result.Result = await UgyfelterBll.GetLinkAsync(_context, sid, dto); tr.Commit(); } catch (Exception ex) { tr.Rollback(); result.Error = ex.InmostMessage(); } return(result); }
public static async Task <string> GetLinkAsync(ossContext context, string sid, UgyfelDto dto) { SessionBll.Check(context, sid); await CsoportDal.JogeAsync(context, JogKod.UGYFELEKMOD); await UgyfelDal.Lock(context, dto.Ugyfelkod, dto.Modositva); var entity = await UgyfelDal.GetAsync(context, dto.Ugyfelkod); if (entity.Kikuldesikod == null) { throw new Exception("Ez az ügyfél még nem kapott ügyféltér linket!"); } var up = new UgyfelterParam { Particiokod = (int)context.CurrentSession.Particiokod, Ugyfelkod = entity.Ugyfelkod, Kikuldesikod = entity.Kikuldesikod }; return(Link(up)); }
public static async Task <string> CreateNewLinkAsync(ossContext context, string sid, UgyfelDto dto) { SessionBll.Check(context, sid); await CsoportDal.JogeAsync(context, JogKod.UGYFELEKMOD); await UgyfelDal.Lock(context, dto.Ugyfelkod, dto.Modositva); var entity = await UgyfelDal.GetAsync(context, dto.Ugyfelkod); var kikuldesikod = Guid.NewGuid().ToString(); var up = new UgyfelterParam { Particiokod = (int)context.CurrentSession.Particiokod, Ugyfelkod = dto.Ugyfelkod, Kikuldesikod = kikuldesikod }; entity.Kikuldesikod = kikuldesikod; entity.Kikuldesikodidopontja = DateTime.Now; await UgyfelDal.UpdateAsync(context, entity); return(Link(up)); }