public bool DeleteOperatie(Operatie operatie) { try { _operatieWrite = new WriteOperatieRepository(context); _operatieWrite.Delete(operatie.Id); context.SaveChanges(); return(true); } catch (Exception e) { var message = DbEntityCustomException.BuildMessageExceptions(e); throw new DbEntityCustomException(message); } }
/// <inheritdoc /> /// <summary> /// Adds the operatie. /// </summary> /// <param name="operatie">The operatie.</param> /// <param name="detaliuComanda">The detaliu comanda.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> /// <exception cref="DbEntityCustomException"></exception> public bool AddOperatie(Operatie operatie, DetaliuComanda detaliuComanda) { try { _operatieWrite = new WriteOperatieRepository(context); _detaliuComandaWrite = new WriteDetaliuComandaRepository(context); _operatieWrite.Create(operatie); if (detaliuComanda.Operaties == null) { detaliuComanda.Operaties = new List <Operatie>(); } detaliuComanda.Operaties.Add(operatie); _detaliuComandaWrite.Update(detaliuComanda); context.SaveChanges(); return(true); } catch (Exception e) { var message = DbEntityCustomException.BuildMessageExceptions(e); throw new DbEntityCustomException(message); } }