Exemplo n.º 1
0
 // POST: api/T_Souvenirs
 public Responses Post([FromBody] T_SouvenirViewModel entity)
 {
     return(T_SouvenirRepo.Update(entity));
 }
Exemplo n.º 2
0
 // PUT: api/T_Souvenirs/5
 public Responses Put(int id, [FromBody] T_SouvenirViewModel entity)
 {
     entity.Id = id;
     return(T_SouvenirRepo.Update(entity));
 }
Exemplo n.º 3
0
        public static T_SouvenirViewModel GetById(int id)
        {
            T_SouvenirViewModel result = new T_SouvenirViewModel();

            using (var db = new MarcomContext())
            {
                result = (from t in db.t_souvenir
                          join e in db.m_employee on
                          t.received_by equals e.id
                          << << << < HEAD
                          join tsi in db.t_souvenir_item on
                          t.id equals tsi.t_souvenir_id
                          == == == =

                                  join tsi in db.t_souvenir_item on
                                  t.id equals tsi.t_souvenir_id
                                  into temp
                                  from j in temp.DefaultIfEmpty()

                                  >> >> >> > 9fa68a320bb1933c32d2a3bf22524c0ca4af5ce7
                                  where t.id == id
                                  select new T_SouvenirViewModel
                        {
                        Id = t.id,               //
                        Code = t.code,           //
                        Type = t.type,           //
                        TEventId = t.t_event_id, //
                        RequestBy = t.request_by,
                        RequestDate = t.request_date,
                        RequestDueDate = t.request_due_date,
                        ApprovedBy = t.approved_by,
                        ApprovedDate = t.approved_date,

                        ReceivedBy = t.received_by,      //
                        FirstName = e.first_name,
                        LastName = e.last_name,

                        ReceivedDate = t.received_date,      //
                        SettlementBy = t.settlement_by,
                        SettlementDate = t.settlement_date,
                        SettlementApprovedBy = t.settlement_approved_by,
                        SettlementApprovedDate = t.settlement_approved_date,
                        Status = t.status,
                        Note = t.note,
                        RejectReason = t.reject_reason,
                        IsDelete = t.is_delete,
                        CreatedBy = t.created_by,
                        CreatedDate = t.created_date,
                        UpdatedBy = t.updated_by,
                        UpdatedDate = t.updated_date,
                        << << << < HEAD
                        == == == =


                            //QtyItem = tsi.qty,
                            //MSouvNir = tsi.m_souvenir_id,
                            //NoteItem = tsi.note
                            //MSouvNir = (int)j.m_souvenir_id,
                            //QtyItem = j.qty.GetValueOrDefault(),
                            //NoteItem = String.IsNullOrEmpty(j.note) ? "" : j.note
                            >> >> >> > 9fa68a320bb1933c32d2a3bf22524c0ca4af5ce7

                            QtyItem = tsi.qty,
                        MSouvNir = tsi.m_souvenir_id,
                        NoteItem = tsi.note
                    }).FirstOrDefault();