예제 #1
0
        public void Save(InvoiceItem item)
        {
            item.GetValidationErrors().ThrowIfHasErrors();

            var invoice = item.Id == 0 ? Db.CreateAndAdd <Invoice>() : Db.Set <Invoice>().Single(x => x.Id == item.Id);

            invoice.WorkTaskId = item.TaskId;
            invoice.Remarks    = item.Remarks;
            invoice.Created    = item.Created;

            Db.SaveChanges();

            item.Id = invoice.Id;
        }