public async Task <IActionResult> location(m_Loc device)
        {
            if (await repo.GetLocation(device.LocationID) != null)
            {
                return(BadRequest("location already exists"));
            }
            var created = await repo.CreateLoc(device);

            return(Ok(created));
        }
Beispiel #2
0
        public async Task <m_Loc> CreateLoc(m_Loc device)
        {
            device.createdOn = DateTime.Now;
            device.isEnabled = true;
            var new_log = await _context.m_Loc.AddAsync(device);

            await _context.SaveChangesAsync();

            return(new_log.Entity);
        }
Beispiel #3
0
        public async Task <m_Loc> UpdateLoc(m_Loc device)
        {
            var result = await _context.m_Loc.FirstOrDefaultAsync(e => e.LocationID == device.LocationID);

            result.LocationID       = device.LocationID;
            result.LcoationText     = device.LcoationText;
            result.WorkCenter       = device.WorkCenter;
            result.Plant            = device.Plant;
            result.Geo              = device.Geo;
            result.ParantLocationID = device.ParantLocationID;
            result.isEnabled        = device.isEnabled;
            result.modifiedOn       = DateTime.Now;
            result.modifiedBy       = device.modifiedBy;
            await _context.SaveChangesAsync();

            return(result);
        }
        public async Task <IActionResult> locationupdate(m_Loc device)
        {
            var created = await repo.UpdateLoc(device);

            return(Ok(created));
        }