public IActionResult UpdateTimeZones(IEnumerable <Upd_VM.TimeZone> timeZones) { try { if (ModelState.IsValid) { IEnumerable <GeonamesAPI.Domain.TimeZone> result = repository.UpdateTimeZones(timeZones); if (result != null && result.Count() > 0) { var primaryKey = timeZones .Select(inputTimeZone => inputTimeZone.TimeZoneId) .FirstOrDefault(); byte[] inputRowId = timeZones .Where(inputTimeZone => inputTimeZone.TimeZoneId == primaryKey) .Select(inputTimeZone => inputTimeZone.RowId) .FirstOrDefault(); byte[] outputRowId = result .Where(outputTimeZone => outputTimeZone.TimeZoneId == primaryKey) .Select(outputTimeZone => outputTimeZone.RowId) .FirstOrDefault(); bool rowIdsAreEqual = inputRowId.SequenceEqual(outputRowId); if (rowIdsAreEqual) { return(BadRequest(ErrMsgs.ErrorMessages_US_en.NotUpdated_MultipleEntries)); } else { return(Ok(result)); } } else { return(StatusCode(500)); } } else { return(BadRequest(ModelState)); } } catch (Exception ex) { Debug.WriteLine(ex); throw; } }