Exemple #1
0
        public IHttpActionResult UpdateLookUpValue(MasterCurrencyFile data)
        {
            if (data != null)
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var record = entity.CurrencyFiles.Where(x => x.CurrCode == data.CurrCode).First();
                record.Country   = data.Country;
                record.SwiftCode = data.SwiftCode;
                record.XRate     = data.XRate;
                record.EdtDt     = data.EdtDt;

                try
                {
                    entity.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    throw;
                }
            }
            return(Ok(data));
        }
Exemple #2
0
        public IHttpActionResult DeleteLookUpValue(MasterCurrencyFile data)
        {
            var record = entity.CurrencyFiles.Where(x => x.CurrCode == data.CurrCode).First();

            if (record == null)
            {
                return(NotFound());
            }

            entity.CurrencyFiles.Remove(record);
            entity.SaveChanges();

            return(Ok(record));
        }
Exemple #3
0
        public IHttpActionResult SaveLookUpValue(MasterCurrencyFile data)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            entity.CurrencyFiles.Add(new CurrencyFile {
                Country = data.Country, SwiftCode = data.SwiftCode, CurrCode = data.CurrCode, XRate = data.XRate, EdtDt = data.EdtDt
            });
            entity.SaveChanges();

            return(Ok(data));
        }